Mega Code Archive

 
Categories / Delphi / Functions
 

Isleapyear - returns true if a given calendar year is a leap year sysutils unit

function IsLeapYear ( const Year : Word ) : Boolean; Description The IsLeapYear function returns true if a given calendar value is a leap year. Year can have a value 0..9999 Related commands DayOfTheYear Gives the day of the year for a TDateTime value (ISO 8601) DaysInAYear Gives the number of days in a year MonthDays Gives the number of days in a month MonthOfTheYear Gives the month of the year for a TDateTime value Example code : Was the year 2000 a leap year? begin if IsLeapYear(2000) then ShowMessage('2000 was a leap year') else ShowMessage('2000 was not a leap year'); end; Show full unit code 2000 was a leap year