Sign in Join
FPDoc Onlineexperiment

HourOfTheDay function

In unit DateUtils

Calculate the hour of a given TDateTime value.

Declaration

pascal
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

Example: ex43

pascal
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.

An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.