Skip to content

DateOf ​

The DateOf function strips the time portion from a TDateTime value, by extracting the date part from the parameter AValue and returning the result.

The time portion of AValue is set to 00:00:00 - or midnight, and excluded.

Declaration: Function DateOf(const AValue: TDateTime): TDateTime;

An example follows.

pascal
procedure OnMapEvent(var Value:Variant);
var
  TrimDate : TDateTime;
  DispDate : string;
begin
  TrimDate := DateOf(Now)
  DispDate := FormatDateTime('dd mmm yyyy', TrimDate)

 //Displays as dd mmm yyyy only
  LogInfo('Formatted Date is: ' + DispDate);

end;

Please also see Date which performs a similar function.