DateTime.Compare Method

Windows Automotive 5.0/5.5
Compares two date/time values in order to determine their relative value.

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

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 ValueMeaning
Less than zeroThe t1 object is less than the t2 object.
ZeroThe t1 object is equal to the t2 object.
Greater than zeroThe t1 object is greater than the t2 object.

The two date/time values must be in the same time zone.

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

Community Additions

ADD
Show: