DelphiBasics
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
DaysInAMonthGives the number of days in a month
DaysInAYearGives the number of days in a year
MinsPerDayGives the number of minutes in a day
SecsPerDayGives the number of seconds in a day
 Download this web site as a Windows program.




 
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
 
Delphi Programming © Neil Moffatt . All rights reserved.  |  Home Page