IChronoLocalDateTime.CompareTo(IChronoLocalDateTime) Method
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.
Compares this date-time to another date-time, including the chronology.
[Android.Runtime.Register("compareTo", "(Ljava/time/chrono/ChronoLocalDateTime;)I", "GetCompareTo_Ljava_time_chrono_ChronoLocalDateTime_Handler:Java.Time.Chrono.IChronoLocalDateTime, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", ApiSince=26)]
public virtual int CompareTo(Java.Time.Chrono.IChronoLocalDateTime? other);
[<Android.Runtime.Register("compareTo", "(Ljava/time/chrono/ChronoLocalDateTime;)I", "GetCompareTo_Ljava_time_chrono_ChronoLocalDateTime_Handler:Java.Time.Chrono.IChronoLocalDateTime, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", ApiSince=26)>]
abstract member CompareTo : Java.Time.Chrono.IChronoLocalDateTime -> int
override this.CompareTo : Java.Time.Chrono.IChronoLocalDateTime -> int
Parameters
- other
- IChronoLocalDateTime
the other date-time to compare to, not null
Returns
the first nonzero comparison of the local dates, local times, and chronologies, in that order; otherwise zero. The local-date comparison can itself compare chronologies.
- Attributes
Remarks
Compares this date-time to another date-time, including the chronology.
The default implementation compares the local dates first, then the local times if the dates compare equal, and then the chronologies if both compare equal. The local-date comparison can itself compare chronologies after comparing epoch days, before the local times are compared. The comparison is "consistent with equals", as defined by Comparable.
For example, the following is the comparator order: <ol> <li>2012-12-03T12:00 (ISO)</li> <li>2012-12-04T12:00 (ISO)</li> <li>2555-12-04T12:00 (ThaiBuddhist)</li> <li>2012-12-05T12:00 (ISO)</li> </ol> Values #2 and #3 represent the same date-time on the time-line. When two values represent the same date-time, the chronology ID is compared to distinguish them. This step is needed to make the ordering "consistent with equals".
If all the date-time objects being compared are in the same chronology, then the additional chronology stage is not required and only the local date-time is used.
This default implementation performs the comparison defined above.
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.