OffsetDateTime.CompareTo(OffsetDateTime) 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.
[Android.Runtime.Register("compareTo", "(Ljava/time/OffsetDateTime;)I", "", ApiSince=26)]
public int CompareTo(Java.Time.OffsetDateTime? other);
[<Android.Runtime.Register("compareTo", "(Ljava/time/OffsetDateTime;)I", "", ApiSince=26)>]
member this.CompareTo : Java.Time.OffsetDateTime -> int
Parameters
- other
- OffsetDateTime
the other date-time to compare to, not null
Returns
A negative value, zero, or a positive value according to the ordering described in the remarks.
- Attributes
Remarks
Compares this date-time to another date-time. The comparison is based on the instant then on the local date-time. It is "consistent with equals", as defined by Comparable. For example, the following is the comparator order:
- 2008-12-03T10:30+01:00
- 2008-12-03T11:00+01:00
- 2008-12-03T12:00+02:00
- 2008-12-03T11:30+01:00
- 2008-12-03T12:00+01:00
- 2008-12-03T12:30+01:00
Values #2 and #3 represent the same instant on the time-line. When two values represent the same instant, the local date-time is compared to distinguish them. This step is needed to make the ordering consistent with equals().
Java reference for java.time.OffsetDateTime.compareTo.