function date_is_leap_year in Date 6.2
Same name and namespace in other branches
- 5.2 date_php4/date_php4.inc \date_is_leap_year()
- 6 date_php4/date_php4.inc \date_is_leap_year()
Returns true for a leap year, else FALSE. Works outside normal date range.
Parameters
int $year:
Return value
boolean
6 calls to date_is_leap_year()
- date_calc_days_in_month in date_php4/
date_php4_calc.inc - Find the number of days in the given month.
- date_calc_gregorian_to_ISO in date_php4/
date_php4_calc.inc - Converts from Gregorian Year-Month-Day to ISO Year-WeekNumber-WeekDay
- date_calc_julian_date in date_php4/
date_php4_calc.inc - Returns number of days since 31 December of year before given date.
- date_php4.inc in date_php4/
date_php4.inc - _date_getdate in date_php4/
date_php4_lib.inc - Low-level function that returns the getdate() array for pre-1970 and post-2038 dates.
File
- date_php4/
date_php4.inc, line 1057
Code
function date_is_leap_year($year) {
if ($year < 1000) {
return FALSE;
}
if ($year < 1582) {
// pre Gregorio XIII - 1582
return $year % 4 == 0;
}
else {
// post Gregorio XIII - 1582
return $year % 4 == 0 && $year % 100 != 0 || $year % 400 == 0;
}
}