Sign in Join
FPDoc Onlineexperiment

DaysInAMonth function

In unit DateUtils

Number of days in a month of a certain year.

Declaration

pascal
function DaysInAMonth(const AYear: Word; const AMonth: Word): Word

Arguments

AYear

Year in which the month occurs.

AMonth

Month of which the number of days should be returned.

Function result

The number of days in month AMonth, in year AYear.

Description

DaysInYMonth returns the number of days in the month AMonth in the year AYear. The return value takes leap years into account.

See also

Example: ex17

pascal
Program Example17;

{ This program demonstrates the DaysInAMonth function }

Uses SysUtils,DateUtils;

Var
  Y,M : Word;

Begin
  For Y:=1992 to 2010 do
    For M:=1 to 12 do
      Writeln(LongMonthNames[m],' ',Y,' has ',DaysInAMonth(Y,M),' days.');
End.

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