DaysPerMonth function
Date/Time routines
Return to Introduction  Previous page  Next page
Unit
acUtils  

Declaration
function DaysPerMonth(AYear: Integer; AMonth: Word): Byte;  

Description
The DaysPerMonth returns the number of days in specified month of year.  

Original code
function DaysPerMonth(AYear: Integer; AMonth: Word): Byte;  
const  
  DaysInMonth: Array[1..12of Integer = (312831303130313130313031);  
begin  
  Result := DaysInMonth[AMonth];  
  if (AMonth = 2and IsLeapYear(AYear) then Inc(Result); // leap-year Feb is special  
end;