Skip to content

HourOfTheYear ​

HourOfTheYear returns the number of complete hours between the TDateTime value entered as AValue, and 12:00 A.M. of the first day of the year that includes AValue.

Declaration: Function HourOfTheYear(const AValue: TDateTime): Word;

A simple example follows.

pascal
procedure ScriptEvent (var Value : variant);
var
  TheYear : word;
begin
 //YESTERDAY is 28-11-2023, so the result is 7944
  TheYear := HourOfTheYear(Yesterday);
  LogInfo('The number of hours since 1st Jan are '+IntToStr(TheYear));
end;