IComparerClass.DateTimeComparer

Syntax

DateTimeComparer: IComparer;

Description

The DateTimeComparer property returns an object to compare elements of the DateTime type.

Example

Sub Main;

Var

Com: IComparer;

d, d1: DateTime;

i, i1, i2: Integer;

Begin

Com:=Comparer.DateTimeComparer;

d:=DateTime.Compose(2000,01,01,0, 0, 0, 0);

d1:=DateTime.Compose(3000,01,01,0, 0, 0, 0);

i:=Com.Compare(d, DateTime.Now);

i1:=Com.Compare(d1, DateTime.Now);

i2:=Com.Compare(d, d1);

End Sub Main;

After executing the example the "i, i1, i2" variables contain "-1, 1, -1" respectively.

See also:

IComparerClass