Delphi Programming RTL Reference|By Category|Alphabetically|By Unit
type TValueRelationship = -1..1
function CompareDateTime(const ADate, BDate: TDateTime) : TValueRelationship
Compares two TDateTime values (returns "less", "equal" or "greater").
TValueRelationship represents the relationship between two values. Each of three TValueRelationship values has a "liked" symbolic constant:
-1 [LessThanValue] The first value is less than the second value.
0 [EqualsValue] The two values are equal.
1 [GreaterThanValue] 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.
var ThisMoment, FutureMoment : TDateTime;
ThisMoment := Now;
FutureMoment := IncDay(ThisMoment, 6); //adds 6 days
//CompareDateTime(ThisMoment, FutureMoment) returns LessThanValue (-1)
//CompareDateTime(FutureMoment, ThisMoment) returns GreaterThanValue (1)
|
CompareTime,
CompareDate,
DateOf,
|
Free Delphi code snippet inside every Delphi Newsletter! |
|
|
|
Got some code to share? Got a question? Need some help? |
|
|