DateTime.CompareTo Method
Compares a specified date/time to this date/time instance in order to determine their relative value.
Namespace: System
Assembly: mscorlib (in mscorlib.dll)
Syntax
public int CompareTo (
Objectval
)
Parameters
- val
An Object instance that specifies a date and time.
Return Value
An integer that specifies the relative value of the val object to this instance of date/time.
Return Value | Meaning |
---|---|
Less than zero | This date/time instance is less than the val object. |
Zero | This date/time instance is equal to the val object. |
Greater than zero | This date/time instance is greater than the val object. |
Remarks
The date/time value that is specified by the val parameter must be in the same time zone as this instance of the date/time.
Version Information
Available in the .NET Micro Framework versions 2.0, 2.5, 3.0, 4.0, and 4.1.