Sign in Join
FPDoc Onlineexperiment

DaysInMonth function

In unit DateUtils

Return the number of days in the month in which a date occurs.

Declaration

pascal
function DaysInMonth(const AValue: TDateTime): Word

Arguments

AValue

Date in month of which to calculate the number of days.

Function result

Number of days in the month in which AValue occurs.

Description

DaysInMonth returns the number of days in the month in which AValue falls. The return value takes leap years into account.

See also

Example: ex16

pascal
Program Example16;

{ This program demonstrates the DaysInMonth 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 ',DaysInMonth(EncodeDate(Y,M,1)),' days.');
End.

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