|   | php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
| 
 PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits              [2001-08-15 14:25 UTC] martin at diers dot cc
  [2002-04-09 18:53 UTC] jimw@php.net
  [2002-05-12 00:00 UTC] php-bugs at lists dot php dot net
  [2002-05-12 03:18 UTC] mfischer@php.net
  [2002-05-12 11:15 UTC] markonen@php.net
  [2002-06-10 03:54 UTC] mfischer@php.net
 | |||||||||||||||||||||||||||
|  Copyright © 2001-2025 The PHP Group All rights reserved. | Last updated: Fri Oct 31 14:00:01 2025 UTC | 
The easter_days function returns bad data for years <= 1752. Here is a way to verify. Because Easter always falls on a Sunday, the following function should always return "Sunday": function EasterDOW($year) { $jdayc = easter_days($year); $jdmar21 = gregoriantojd(3, 21, $year); $jdeaster = $jdmar21 + $jdayc; return JDDayOfWeek($jdeaster, 1); } The formula for calculating easter has been the same since 1582. The standerd Delambre Easter algorithm is able to generate the date of easter for any gregorian date after 1582. The following function may be used to duplicate the functionality of easter_days for any date since 1582: function easter_days2($year) { #First calculate the date of easter using #Delambre's algorithm. $a = $year % 19; $b = floor($year / 100); $c = $year % 100; $d = floor($b / 4); $e = $b % 4; $f = floor(($b + 8) / 25); $g = floor(($b - $f + 1) / 3); $h = (19 * $a + $b - $d - $g + 15) % 30; $i = floor($c / 4); $k = $c % 4; $l = (32 + 2 * $e + 2 * $i - $h - $k) % 7; $m = floor(($a + 11 * $h + 22 * $l) / 451); $n = ($h + $l - 7 * $m + 114); $month = floor($n / 31); $day = $n % 31 + 1; #Return the difference between the JulianDayCount #for easter and March 21'st of the same year, #in order to duplicate the functionality of the #easter_days function return GregorianToJD($month, $day, $year) - GregorianToJD(3,21,$year); }