Period Class
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
A date-based amount of time in the ISO-8601 calendar system, such as '2 years, 3 months and 4 days'.
[Android.Runtime.Register("java/time/Period", ApiSince=26, DoNotGenerateAcw=true)]
public sealed class Period : Java.Lang.Object, IDisposable, Java.IO.ISerializable, Java.Time.Chrono.IChronoPeriod
[<Android.Runtime.Register("java/time/Period", ApiSince=26, DoNotGenerateAcw=true)>]
type Period = class
inherit Object
interface ISerializable
interface IJavaObject
interface IDisposable
interface IJavaPeerable
interface IChronoPeriod
interface ITemporalAmount
- Inheritance
- Attributes
- Implements
Remarks
A date-based amount of time in the ISO-8601 calendar system, such as '2 years, 3 months and 4 days'.
This class models a quantity or amount of time in terms of years, months and days. See Duration for the time-based equivalent to this class.
Durations and periods differ in their treatment of daylight savings time when added to ZonedDateTime. A Duration will add an exact number of seconds, thus a duration of one day is always exactly 24 hours. By contrast, a Period will add a conceptual day, trying to maintain the local time.
For example, consider adding a period of one day and a duration of one day to 18:00 on the evening before a daylight savings gap. The Period will add the conceptual day and result in a ZonedDateTime at 18:00 the following day. By contrast, the Duration will add exactly 24 hours, resulting in a ZonedDateTime at 19:00 the following day (assuming a one hour DST gap).
The supported units of a period are ChronoUnit#YEARS YEARS, ChronoUnit#MONTHS MONTHS and ChronoUnit#DAYS DAYS. All three fields are always present, but may be set to zero.
The ISO-8601 calendar system is the modern civil calendar system used today in most of the world. It is equivalent to the proleptic Gregorian calendar system, in which today's rules for leap years are applied for all time.
The period is modeled as a directed amount of time, meaning that individual parts of the period may be negative.
Added in 1.8.
Java documentation for java.time.Period.
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.
Properties
| Name | Description |
|---|---|
| Chronology |
Gets the chronology of this period, which is the ISO calendar system. |
| Class |
Returns the runtime class of this |
| Days |
Gets the amount of days of this period. |
| Handle |
The handle to the underlying Android instance. (Inherited from Object) |
| IsNegative |
Checks if any of the three units of this period are negative. |
| IsZero |
Checks if all three units of this period are zero. |
| JniIdentityHashCode |
Gets the identity hash code assigned to this Java peer by the interop runtime. (Inherited from Object) |
| JniManagedPeerState | (Inherited from JavaObject) |
| JniPeerMembers | |
| Months |
Gets the amount of months of this period. |
| PeerReference |
Gets the JNI object reference for this Java peer. (Inherited from Object) |
| ThresholdClass |
This API supports the Mono for Android infrastructure and is not intended to be used directly from your code. (Inherited from Object) |
| ThresholdType |
This API supports the Mono for Android infrastructure and is not intended to be used directly from your code. (Inherited from Object) |
| Units |
Gets the set of units supported by this period. |
| Years |
Gets the amount of years of this period. |
| Zero | |
Methods
| Name | Description |
|---|---|
| AddTo(ITemporal) |
Adds this period to the specified temporal object. |
| Between(LocalDate, LocalDate) |
Obtains a Period consisting of the number of years, months, and days between two dates. |
| Clone() |
Creates and returns a copy of this object. (Inherited from Object) |
| Construct(JniObjectReference, JniObjectReferenceOptions) | (Inherited from JavaObject) |
| Dispose() |
Releases the resources held by this Java peer. (Inherited from Object) |
| Dispose(Boolean) |
Releases the resources held by this Java peer. (Inherited from Object) |
| DisposeUnlessReferenced() | (Inherited from JavaObject) |
| Equals(Object) | (Inherited from JavaObject) |
| Equals(Object) |
Indicates whether some other object is "equal to" this one. (Inherited from Object) |
| From(ITemporalAmount) |
Obtains an instance of Period from a temporal amount. |
| Get(ITemporalUnit) |
Gets the value of the requested unit. |
| GetHashCode() |
Returns a hash code value for the object. (Inherited from Object) |
| JavaFinalize() |
Called by the garbage collector on an object when garbage collection determines that there are no more references to the object. (Inherited from Object) |
| Minus(ITemporalAmount) |
Returns a copy of this period with the specified period subtracted. |
| MinusDays(Int64) |
Returns a copy of this period with the specified days subtracted. |
| MinusMonths(Int64) |
Returns a copy of this period with the specified months subtracted. |
| MinusYears(Int64) |
Returns a copy of this period with the specified years subtracted. |
| MultipliedBy(Int32) |
Returns a new instance with each element in this period multiplied by the specified scalar. |
| Negated() |
Returns a new instance with each amount in this period negated. |
| Normalized() |
Returns a copy of this period with the years and months normalized. |
| Notify() |
Wakes up a single thread that is waiting on this object's monitor. (Inherited from Object) |
| NotifyAll() |
Wakes up all threads that are waiting on this object's monitor. (Inherited from Object) |
| Of(Int32, Int32, Int32) |
Obtains a Period representing a number of years, months and days. |
| OfDays(Int32) |
Obtains a Period representing a number of days. |
| OfMonths(Int32) |
Obtains a Period representing a number of months. |
| OfWeeks(Int32) |
Obtains a Period representing a number of weeks. |
| OfYears(Int32) | |
| Parse(ICharSequence) |
Obtains a Period from a text string such as PnYnMnD. |
| Parse(String) | |
| Plus(ITemporalAmount) |
Returns a copy of this period with the specified period added. |
| PlusDays(Int64) |
Returns a copy of this period with the specified days added. |
| PlusMonths(Int64) |
Returns a copy of this period with the specified months added. |
| PlusYears(Int64) |
Returns a copy of this period with the specified years added. |
| SetHandle(IntPtr, JniHandleOwnership) |
Sets the Handle property. (Inherited from Object) |
| SetPeerReference(JniObjectReference, JniObjectReferenceOptions) | (Inherited from JavaObject) |
| SubtractFrom(ITemporal) |
Subtracts this period from the specified temporal object. |
| ToArray<T>() |
Creates a managed array from this Java array wrapper. (Inherited from Object) |
| ToString() |
Returns a string representation of the object. (Inherited from Object) |
| ToTotalMonths() |
Gets the total number of months in this period. |
| UnregisterFromRuntime() |
Unregisters this Java peer from the interop runtime. (Inherited from Object) |
| Wait() |
Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>. (Inherited from Object) |
| Wait(Int64, Int32) |
Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed. (Inherited from Object) |
| Wait(Int64) |
Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed. (Inherited from Object) |
| WithDays(Int32) |
Returns a copy of this period with the specified amount of days. |
| WithMonths(Int32) |
Returns a copy of this period with the specified amount of months. |
| WithYears(Int32) |
Returns a copy of this period with the specified amount of years. |
Explicit Interface Implementations
| Name | Description |
|---|---|
| IJavaPeerable.Disposed() | (Inherited from JavaObject) |
| IJavaPeerable.Finalized() | (Inherited from JavaObject) |
| IJavaPeerable.JniObjectReferenceControlBlock | (Inherited from JavaObject) |
| IJavaPeerable.SetJniIdentityHashCode(Int32) | (Inherited from JavaObject) |
| IJavaPeerable.SetJniManagedPeerState(JniManagedPeerStates) | (Inherited from JavaObject) |
| IJavaPeerable.SetPeerReference(JniObjectReference) | (Inherited from JavaObject) |
| IJavaPeerable.UnregisterFromRuntime() | |
Extension Methods
| Name | Description |
|---|---|
| GetJniTypeName(IJavaPeerable) |
Gets the JNI name of the type of the instance |
| JavaAs<TResult>(IJavaPeerable) |
Try to coerce |
| JavaCast<TResult>(IJavaObject) |
Performs an Android runtime-checked type conversion. |
| JavaCast<TResult>(IJavaObject) | |
| TryJavaCast<TResult>(IJavaPeerable, TResult) |
Try to coerce |