Sign in Join
FPDoc Onlineexperiment

EndOfADay function

In unit DateUtils

Calculates a TDateTime value representing the end of a specified day.

Declaration

pascal
function EndOfADay(const AYear: Word; const AMonth: Word; 
 const ADay: Word): TDateTime; overload

Arguments

AYear

Year.

AMonth

Month in the year.

ADay

Day in the month.

Function result

A TDateTime value representing the time 23:59:59.999 of the given day.

Description

EndOfADay returns a TDateTime value with the date/time indication of the last moment (23:59:59.999) of the day given by AYear, AMonth, ADay.

The day may also be indicated with a AYear, ADayOfYear pair.

See also

Example: ex39

pascal
Program Example39;

{ This program demonstrates the EndOfADay function }

Uses SysUtils,DateUtils;

Const
  Fmt = '"End of the day : "dd mmmm yyyy hh:nn:ss';

Var
  Y,M,D : Word;

Begin
  Y:=YearOf(Today);
  M:=MonthOf(Today);
  D:=DayOf(Today);
  Writeln(FormatDateTime(Fmt,EndOfADay(Y,M,D)));
  DecodeDateDay(Today,Y,D);
  Writeln(FormatDateTime(Fmt,EndOfADay(Y,D)));
End.

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