From RAD Studio API Documentation
Jump to: navigation, search


function CompareDateTime(const A, B: TDateTime): TValueRelationship;


extern DELPHI_PACKAGE System::Types::TValueRelationship __fastcall CompareDateTime(const System::TDateTime A, const System::TDateTime B);


Type Visibility Source Unit Parent
function public
System.DateUtils System.DateUtils


Indicates the relationship between two TDateTime values.

Call CompareDateTime to compare the two TDateTime values specified by A and B. CompareDateTime returns:

  • LessThanValue if A is earlier than B.
  • EqualsValue if A is the same as B.
  • GreaterThanValue if A is later than B.

Note: CompareDateTime differs from a direct comparison of the corresponding double precision values in that two TDateTime values are considered the same if they have the same value down to the millisecond. It is possible to create two TDateTime values that differ numerically when viewed as doubles, but which represent the same year, month, day, hour, minute, second, and millisecond.

See Also

Code Examples