Delphi Programming RTL Reference|By Category|Alphabetically|By Unit
type TValueRelationship = -1..1
function CompareDate(const ADate, BDate: TDateTime) : TValueRelationship
Compares two TDateTime values (returns "less", "equal" or "greater"). Ignores the Time part if both values occur at the same time.
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 occurs earlier in the day specified by BDate.
EqualsValue if time parts of both ADate and BDate are the same, ignoring the Date part.
GreaterThanValue if ADate occurs later in the day specified by BDate.
var ThisMoment, AnotherMoment : TDateTime;
ThisMoment := Now;
AnotherMoment := IncHour(ThisMoment, 6); //adds 6 hours
//CompareDate(ThisMoment, AnotherMoment) returns LessThanValue (-1)
//CompareDate(AnotherMoment, ThisMoment) returns GreaterThanValue (1)
|
CompareTime,
CompareDateTime,
DateOf,
|
Free Delphi code snippet inside every Delphi Newsletter! |
|
|
|
Got some code to share? Got a question? Need some help? |
|
|