Sign in Join
FPDoc Onlineexperiment

EndOfAMonth function

In unit DateUtils

Calculate a TDateTime value representing the last day of the indicated month.

Declaration

pascal
function EndOfAMonth(const AYear: Word; const AMonth: Word): TDateTime

Arguments

AYear

Year in which month occurs.

AMonth

Month used to calculate the last day.

Function result

TDateTime value indicating the last day of AMonth in year AYear.

Description

EndOfAMonth e returns a TDateTime value with the date of the last day of the month indicated by the AYear, AMonth pair.

See also

Example: ex31

pascal
Program Example31;

{ This program demonstrates the EndOfAMonth function }

Uses SysUtils,DateUtils;

Const
  Fmt = '"Last day of this month : "dd mmmm yyyy';
Var
  Y,M : Word;

Begin
  Y:=YearOf(Today);
  M:=MonthOf(Today);
  Writeln(FormatDateTime(Fmt,EndOfAMonth(Y,M)));
End.

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