Skip to content

HourOf (HourOfTheDay) ​

Call the HourOf function to obtain the hour of the day represented by a specified TDateTime value.

HourOf returns an integer value from 0 through 23 only.

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

Function HourOfTheDay( const AValue : TDateTime) : Word;

An example of its use.

pascal
procedure ScriptEvent (var Value : variant);
var
  vHour : string;
begin
 //Get the hour from the selected date in 24 hour format
  vHour := IntToStr(HourOf(Now));
  LogInfo('Hour is        : ' + vHour);
  LogInfo('');
end;

HourOf has the same functionality as the HourOfTheDay function.