DateTime.Compare Method
Compares two date/time values in order to determine their relative value.
Namespace: System
Assembly: mscorlib (in mscorlib.dll)
Syntax
public static int Compare (
DateTime t1,
DateTime t2
)
Parameters
- t1
A DateTime object that specifies a date and time. - t2
A DateTime object that specifies a date and time.
Return Value
An integer that specifies the relative value of the t1 and t2 objects.
Return Value | Meaning |
---|---|
Less than zero | The t1 object is less than the t2 object. |
Zero | The t1 object is equal to the t2 object. |
Greater than zero | The t1 object is greater than the t2 object. |
Remarks
The two date/time values must be in the same time zone.
Version Information
Available in the .NET Micro Framework versions 2.0, 2.5, 3.0, 4.0, 4.1, and 4.2.