SmartPascal
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 ?
// Full Unit code.
// -----------------------------------------------------------
// You must store this code in a unit called Unit1 with a form
// called Form1 that has an OnCreate event called FormCreate.
 
unit Unit1;
 
interface
 
uses
  SysUtils,   // Unit containing the MonthDays command
  Forms, Dialogs;
 
type
  TForm1 = class(TForm)
    procedure FormCreate(Sender: TObject);
  end;
 
var
  
Form1: TForm1;
 
implementation
{$R *.dfm} // Include form definitions
 
procedure TForm1.FormCreate(Sender: TObject);

begin
  // How many days in February 2000 ?
  ShowMessage('Days in February 2000 = '+
              IntToStr(MonthDays[IsLeapYear(2000)][2]));
end;
 
end.
Hide full unit code
   Days in February 2000 = 29