DateTime.CompareTo Method

Windows Automotive 5.0/5.5
Compares a specified date/time to this date/time instance in order to determine their relative value.

Namespace: System
Assembly: mscorlib (in mscorlib.dll)

public int CompareTo (
         Object 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 ValueMeaning
Less than zeroThis date/time instance is less than the val object.
ZeroThis date/time instance is equal to the val object.
Greater than zeroThis date/time instance is greater than the val object.

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.

Available in the .NET Micro Framework versions 2.0, 2.5, 3.0, 4.0, 4.1, and 4.2.

Community Additions