Smart
Pascal
MonthDays
Constant
Gives the number of days in a month
SysUtils
unit
const
MonthDays
: array [Boolean] of TDayTable =
((31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31),
(31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31));
Description
The
MonthDays
constant is a useful part of the SysUtils unit. It gives the number of days in a month, with 29 returned for February if the year is a leap year (
Boolean
first array parameter). This is best understood by looking at the sample code.
Related commands
DaysInAMonth
Gives the number of days in a month
DaysInAYear
Gives the number of days in a year
MinsPerDay
Gives the number of minutes in a day
SecsPerDay
Gives the number of seconds in a day
Example code : How many days in February 2000 ?
begin
// How many days in February 2000 ?
ShowMessage('Days in February 2000 = '+
IntToStr(
MonthDays
[IsLeapYear(2000)][2]));
end;
Show full unit code
Days in February 2000 = 29