Appearance
CompareDateTime
Declaration
Function CompareDateTime(const ADate, BDate: TDateTime): TValueRelationship
Example
pascal
procedure OnMapEvent(var Value:Variant);
begin
// compare two date/time values ...
if CompareDateTime(ORDER['DELIVERY_TIMESTAMP'].Value, Now) = GreaterThanValue then
// Delivery Timestamp is future-dated ... use current time instead
Value := Now
else
// timestamp is not future-dated ... use as is
Value := ORDER['DELIVERY_TIMESTAMP'].Value;
end;Description
Compares two TDateTime values and returns "less", "equal" or "greater".
TValueRelationship represents the relationship between two values. Each of three TValueRelationship values is pre-declared as a named constant:
- LessThanValue = -1 // The first value is less than the second value.
- EqualsValue = 0 // The two values are equal.
- GreaterThanValue = 1 // The first value is greater than the second value.
CompareDate results in:
- LessThanValue if ADate is earlier than BDate.
- EqualsValue if date and time parts of both ADate and BDate are the same
- GreaterThanValue if ADate is later than BDate.