Sign in Join
FPDoc Onlineexperiment

StartOfAMonth function

In unit DateUtils

Return first date of month, given a year/month pair.

Declaration

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

Arguments

AYear

A year.

AMonth

Month in the year.

Function result

First day of the month AMonth in AYear.

Description

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

See also

Example: ex30

pascal
Program Example30;

{ This program demonstrates the StartOfAMonth function }

Uses SysUtils,DateUtils;

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

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

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