Sdílet prostřednictvím


Time.Compare(Time, Time) Method

Definition

Compare two Time objects and return a negative number if a is less than b, a positive number if a is greater than b, or 0 if they are equal.

[Android.Runtime.Register("compare", "(Landroid/text/format/Time;Landroid/text/format/Time;)I", "")]
public static int Compare (Android.Text.Format.Time? a, Android.Text.Format.Time? b);
[<Android.Runtime.Register("compare", "(Landroid/text/format/Time;Landroid/text/format/Time;)I", "")>]
static member Compare : Android.Text.Format.Time * Android.Text.Format.Time -> int

Parameters

a
Time

first Time instance to compare

b
Time

second Time instance to compare

Returns

a negative result if a is earlier, a positive result if b is earlier, or 0 if they are equal.

Attributes

Exceptions

if either argument is null

if AllDay is true but hour, minute, and second are not 0.

Remarks

Compare two Time objects and return a negative number if a is less than b, a positive number if a is greater than b, or 0 if they are equal.

This method can return an incorrect answer when the date / time fields of either Time have been set to a local time that contradicts the available timezone information.

Java documentation for android.text.format.Time.compare(android.text.format.Time, android.text.format.Time).

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