Sign in Join
FPDoc Onlineexperiment

EndOfTheMonth function

In unit DateUtils

Calculate a TDateTime value representing the last day of the month, given a day in that month.

Declaration

pascal
function EndOfTheMonth(const AValue: TDateTime): TDateTime

Arguments

AValue

Day in the month of which the last day should be returned.

Function result

TDateTime value representing the last day of the month in which AVAlue is a day.

Description

EndOfTheMonth extracts the year and month parts of AValue and returns a TDateTime value with the date of the first day of that year and month as the EndOfAMonth function.

See also

Example: ex29

pascal
Program Example29;

{ This program demonstrates the EndOfTheMonth function }

Uses SysUtils,DateUtils;

Const
  Fmt = '"last day of this month : "dd mmmm yyyy';

Begin
  Writeln(FormatDateTime(Fmt,EndOfTheMonth(Today)));
End.

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