Share via


IChronoLocalDate.Until Method

Definition

Overloads

Until(ITemporal, ITemporalUnit)

Calculates the amount of time until another date in terms of the specified unit.

Until(IChronoLocalDate)

Calculates the period between this date and another date as a ChronoPeriod.

Until(ITemporal, ITemporalUnit)

Calculates the amount of time until another date in terms of the specified unit.

[Android.Runtime.Register("until", "(Ljava/time/temporal/Temporal;Ljava/time/temporal/TemporalUnit;)J", "GetUntil_Ljava_time_temporal_Temporal_Ljava_time_temporal_TemporalUnit_Handler:Java.Time.Chrono.IChronoLocalDateInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", ApiSince=26)]
public long Until (Java.Time.Temporal.ITemporal? endExclusive, Java.Time.Temporal.ITemporalUnit? unit);
[<Android.Runtime.Register("until", "(Ljava/time/temporal/Temporal;Ljava/time/temporal/TemporalUnit;)J", "GetUntil_Ljava_time_temporal_Temporal_Ljava_time_temporal_TemporalUnit_Handler:Java.Time.Chrono.IChronoLocalDateInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", ApiSince=26)>]
abstract member Until : Java.Time.Temporal.ITemporal * Java.Time.Temporal.ITemporalUnit -> int64

Parameters

endExclusive
ITemporal

the end date, exclusive, which is converted to a ChronoLocalDate in the same chronology, not null

unit
ITemporalUnit

the unit to measure the amount in, not null

Returns

the amount of time between this date and the end date

Implements

Attributes

Remarks

Calculates the amount of time until another date in terms of the specified unit.

This calculates the amount of time between two ChronoLocalDate objects in terms of a single TemporalUnit. The start and end points are this and the specified date. The result will be negative if the end is before the start. The Temporal passed to this method is converted to a ChronoLocalDate using Chronology#date(TemporalAccessor). The calculation returns a whole number, representing the number of complete units between the two dates. For example, the amount in days between two dates can be calculated using startDate.until(endDate, DAYS).

There are two equivalent ways of using this method. The first is to invoke this method. The second is to use TemporalUnit#between(Temporal, Temporal):

// these two lines are equivalent
              amount = start.until(end, MONTHS);
              amount = MONTHS.between(start, end);

The choice should be made based on which makes the code more readable.

The calculation is implemented in this method for ChronoUnit. The units DAYS, WEEKS, MONTHS, YEARS, DECADES, CENTURIES, MILLENNIA and ERAS should be supported by all implementations. Other ChronoUnit values will throw an exception.

If the unit is not a ChronoUnit, then the result of this method is obtained by invoking TemporalUnit.between(Temporal, Temporal) passing this as the first argument and the converted input temporal as the second argument.

This instance is immutable and unaffected by this method call.

Java documentation for java.time.chrono.ChronoLocalDate.until(java.time.temporal.Temporal, java.time.temporal.TemporalUnit).

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.

Applies to

Until(IChronoLocalDate)

Calculates the period between this date and another date as a ChronoPeriod.

[Android.Runtime.Register("until", "(Ljava/time/chrono/ChronoLocalDate;)Ljava/time/chrono/ChronoPeriod;", "GetUntil_Ljava_time_chrono_ChronoLocalDate_Handler:Java.Time.Chrono.IChronoLocalDateInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", ApiSince=26)]
public Java.Time.Chrono.IChronoPeriod? Until (Java.Time.Chrono.IChronoLocalDate? endDateExclusive);
[<Android.Runtime.Register("until", "(Ljava/time/chrono/ChronoLocalDate;)Ljava/time/chrono/ChronoPeriod;", "GetUntil_Ljava_time_chrono_ChronoLocalDate_Handler:Java.Time.Chrono.IChronoLocalDateInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", ApiSince=26)>]
abstract member Until : Java.Time.Chrono.IChronoLocalDate -> Java.Time.Chrono.IChronoPeriod

Parameters

endDateExclusive
IChronoLocalDate

the end date, exclusive, which may be in any chronology, not null

Returns

the period between this date and the end date, not null

Attributes

Remarks

Calculates the period between this date and another date as a ChronoPeriod.

This calculates the period between two dates. All supplied chronologies calculate the period using years, months and days, however the ChronoPeriod API allows the period to be represented using other units.

The start and end points are this and the specified date. The result will be negative if the end is before the start. The negative sign will be the same in each of year, month and day.

The calculation is performed using the chronology of this date. If necessary, the input date will be converted to match.

This instance is immutable and unaffected by this method call.

Java documentation for java.time.chrono.ChronoLocalDate.until(java.time.chrono.ChronoLocalDate).

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.

Applies to