NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

DateTime.Compare

Compares two DateTime values.

[Visual Basic]
Public Shared Function Compare( _
   ByVal t1 As DateTime, _
   ByVal t2 As DateTime _
) As Integer
[C#]
public static int Compare(
   DateTime t1,
   DateTime t2
);
[C++]
public: static int Compare(
   DateTime t1,
   DateTime t2
);
[JScript]
public static function Compare(
   t1 : DateTime,
   t2 : DateTime
) : int;

Parameters

t1
The first DateTime value.
t2
The second DateTime value.

Return Value

Value Type Condition
1 If the first value is less than the second value.
0 If the values are equal.
-1 If the first value is greater than the second value.

Remarks

The Compare method is used the same method as Currency to compare two numbers. It returns an integer representing the results of that comparison:

The values (same as Currency, a negative number) are determined using the following equations:

1 if t 1 > t 2, 0 if t 1 = t 2, or-1 if t 1 < t 2.

DateTime t1 =...

DateTime t2 = ...

If (DateTime.Compare (t1, t2) > 0) Console.WriteLine ("t1 > t2"); If (DateTime.Compare (t1, t2) == 0) Console.WriteLine ("t1 == t2"); If (DateTime.Compare (t1, t2) < 0) Console.WriteLine ("t1 < t2");

See Also

DateTime Structure | DateTime Members | System Namespace | CompareTo | Int32