DaysInAMonth returns the number of days in the specified month and year.

  • AYear accepts values within the range of 1 to 9999 inclusive.

  • AMonth accepts a month value from 1 to 12 inclusive.

Declaration: Function DaysInAMonth(const AYear, AMonth: Word): Word;

An example follows.

procedure ScriptEvent(var Value:Variant);
var
TheYear, TheMonth, NumDays : word;
begin
TheYear := 2024;
TheMonth := 11;
NumDays := DaysInAMonth(TheYear, TheMonth);
LogInfo('Number of days in the month and year - '+IntToStr(NumDays));
 
NumDays := DaysInAMonth(TheYear, TheMonth+1);
LogInfo('Number of days in the month and year - '+IntToStr(NumDays));
LogInfo('');
end;