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 Main;

Var

i, i1: Integer;

Begin

i := DateTime.DaysInMonth(1, 2003);

i1 := DateTime.DaysInMonth(2, 2008);

End Sub Main;

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

See also:

DateTime