DelphiBasics
IsLeapYear
Function
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
DayOfTheYearGives the day of the year for a TDateTime value (ISO 8601)
DaysInAYearGives the number of days in a year
MonthDaysGives the number of days in a month
MonthOfTheYearGives the month of the year for a TDateTime value
 Download this web site as a Windows program.




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