DateTime.DaysInMonth

Syntax

DaysInMonth(Month: Integer; Year: Integer): Integer;

Parameters

Month. Number of the month in the specified year.

Year. Year.

Description

The DaysInMonth method returns the number of days in the specified month of the specified year.

Comments

If incorrect data is entered, an exception is thrown.

Example

Sub UserProc;
Var
    i, i1: Integer;
Begin
    i := DateTime.DaysInMonth(12003);
    i1 := DateTime.DaysInMonth(22008);
End Sub UserProc;

After executing the example the "i" variable contains the 31 value, which is the number of days in January 2003, the "i1" variable contains 29, which is the number of days in February 2008.

See also:

DateTime