Udostępnij za pośrednictwem


IChronoLocalDate.CompareTo(IChronoLocalDate) Method

Definition

Compares this date to another date, including the chronology.

[Android.Runtime.Register("compareTo", "(Ljava/time/chrono/ChronoLocalDate;)I", "GetCompareTo_Ljava_time_chrono_ChronoLocalDate_Handler:Java.Time.Chrono.IChronoLocalDate, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", ApiSince=26)]
public virtual int CompareTo (Java.Time.Chrono.IChronoLocalDate? other);
[<Android.Runtime.Register("compareTo", "(Ljava/time/chrono/ChronoLocalDate;)I", "GetCompareTo_Ljava_time_chrono_ChronoLocalDate_Handler:Java.Time.Chrono.IChronoLocalDate, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", ApiSince=26)>]
abstract member CompareTo : Java.Time.Chrono.IChronoLocalDate -> int
override this.CompareTo : Java.Time.Chrono.IChronoLocalDate -> int

Parameters

other
IChronoLocalDate

the other date to compare to, not null

Returns

the comparator value, negative if less, positive if greater

Attributes

Remarks

Compares this date to another date, including the chronology.

The comparison is based first on the underlying time-line date, then on the chronology. It is "consistent with equals", as defined by Comparable.

For example, the following is the comparator order: <ol> <li>2012-12-03 (ISO)</li> <li>2012-12-04 (ISO)</li> <li>2555-12-04 (ThaiBuddhist)</li> <li>2012-12-05 (ISO)</li> </ol> Values #2 and #3 represent the same date on the time-line. When two values represent the same date, the chronology ID is compared to distinguish them. This step is needed to make the ordering "consistent with equals".

If all the date objects being compared are in the same chronology, then the additional chronology stage is not required and only the local date is used. To compare the dates of two TemporalAccessor instances, including dates in two different chronologies, use ChronoField#EPOCH_DAY as a comparator.

This default implementation performs the comparison defined above.

Java documentation for java.time.chrono.ChronoLocalDate.compareTo(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