HourOfTheWeek returns the number of complete hours between the TDateTime value entered as AValue, and 12:00 A.M. of the first day of the week (Monday) that is specified by AValue.

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

A simple example follows.

procedure ScriptEvent (var Value : variant);
var
TheHour : word;
TheDate : TDateTime;
begin
//The result is 14
TheDate := EncodeDateTime(2023, 11, 27, 14, 25, 15, 650);
TheHour := HourOfTheWeek(TheDate);
LogInfo('The number of hours since the beginning of the week is '+IntToStr(TheHour));
 
//The result is 85
TheDate := EncodeDateTime(2023, 11, 30, 13, 25, 15, 650);
TheHour := HourOfTheWeek(TheDate);
LogInfo('The number of hours since the beginning of the week is '+IntToStr(TheHour));
end;