SameDate compares two TDateTime values A and B, to test whether they represent the same year, month, and day only. The time portion is completely ignored.

SameDate returns True if the two specified values represent the same date, and returns False if they are not the same.

Declaration: function SameDate(const A, B: TDateTime): Boolean;

A simple example showing a passed test and a failed test follows.

procedure ScriptEvent (var Value : variant);
var
DateTime1, DateTime2 : TDateTime;
begin
//These will be the same
DateTime1 := Date;
DateTime2 := Date;
If SameDateTime(DateTime1, DateTime2) then
LogInfo('They are the same date!')
else
LogInfo('They are NOT the same date!');
 
//These will not be the same
DateTime2 := IncMonth(Date,1);
If SameDateTime(DateTime1, DateTime2) then
LogInfo('They are the same date!')
else
LogInfo('They are NOT the same date!');
end;