Skip to content

HourOfTheDay

Calculate the hour of a given TDateTime value

Declaration

Source position: dateutil.inc line 211

  function HourOfTheDay(const AValue: TDateTime) : Word;

Description

HourOfTheDay returns the number of hours that have passed since the start of the day till the moment indicated by AValue. This is a zero-based number, i.e. 00:59:59 will return 0.

See also

Name Description
HourOfTheMonth Calculate the number of hours passed since the start of the month.
HourOfTheWeek Calculate the number of hours elapsed since the start of the week.
HourOfTheYear Calculate the number of hours passed since the start of the year.
MilliSecondOfTheDay Calculate the number of milliseconds elapsed since the start of the day
MinuteOfTheDay Calculate the number of minutes elapsed since the start of the day
SecondOfTheDay Calculate the number of seconds elapsed since the start of the day

Example

Program Example43;
{ This program demonstrates the HourOfTheDay function }
Uses SysUtils,DateUtils;
Var
  N : TDateTime;
Begin
  N:=Now;
  Writeln('Hour of the Day        : ',HourOfTheDay(N));
  Writeln('Minute of the Day      : ',MinuteOfTheDay(N));
  Writeln('Second of the Day      : ',SecondOfTheDay(N));
  Writeln('MilliSecond of the Day : ',
          MilliSecondOfTheDay(N));
End.