Skip to content

IsSameDay ​

IsSameDay performs a test comparing the TDateTime value specified in AValue with a second TDateTime date specified by ABasis.

True is returned if the dates match, or False if they do not match.

The value does not include time, which is set to 00:00:00.

Declaration: Function IsSameDay(const AValue, ABasis: TDateTime): Boolean;

A example showing the function used along with FormatDateTime. In this example, the test will fail and return False.

pascal
procedure ScriptEvent (var Value : variant);
var
  ADate : TDateTime;
begin
  ADate := IncDay(Date, 7);

 if IsSameDay(ADate, Yesterday) then //This check will fail
    LogInfo('The dates are the same.')
 else
    LogInfo('The dates are NOT the same.');

    LogInfo('The date is '+FormatDateTime('dd/mm/yyyy',ADate));
    LogInfo('Compare date is '+FormatDateTime('dd/mm/yyyy',Yesterday));

end;

For additional information, please see DateTime (TDateTime).