[Overview][Constants][Procedures and functions][Index] | Reference for unit 'DateUtils' (#rtl)

# HourOfTheDay

Calculate the hour of a given TDateTime value

## Declaration

Source position: dateutil.inc line 224

`function HourOfTheDay(`
`const AValue: TDateTime`
`):Word;`

## Arguments

`AValue` |  | TDateTime to calculate the hour of.

## Function result

Hour part of AValue.

## 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

HourOfTheYear |  | Calculate the number of hours passed since the start of the year.
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.
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
MilliSecondOfTheDay |  | Calculate the number of milliseconds 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.