Skip to content

Yesterday ​

The Yesterday function returns the date of the day before the current date, as a TDateTime data type.

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

Declaration: Function Yesterday: TDateTime;

A example showing the function used along with FormatDateTime. If the current date is 23/11/2023, then Yesterday would return 22/11/2023.

pascal
procedure ScriptEvent (var Value : variant);
 var myvariable : TDateTime;
begin
 //Date function returns the current date without time
  myvariable := Yesterday;
  LogInfo('The date is ' +FormatDateTime('dd/mm/yyyy', myvariable));
end;

For additional information, please see DateTime (TDateTime).