Windows 11 64 bit
This code only yields up to year 2037. I thought the year 2037 was limited only to 32 bit systems. XAMPP v3.30 stops on 2037 but same code online gives 1970 01 January for every year beyond 2037. Thanks.
$year=2025;
while ($year <= 2050)
{
$easterDate = easter_date($year);
echo $easterYear = date('Y', $easterDate), " ";
echo $easterDay = date('d', $easterDate), " ";
echo $easterMonth = date('F', $easterDate), "<br>";
$year++;
}
2
Answers
No. The function itself can be limited to the years 1970 and 2037 (inclusive).
And note that it has been removed in many PHP >= 5.4 configurations (ref: https://3v4l.org/Jfvi6).
I would not rely on
easter_date()
as it has a lot of caveats. If you look at the notes in the documentation, it shows a better way that uses PHP’s built-in date function to calculate Easter for a given year and allows going beyond 2037 since it doesn’t rely on unix timestamps. Theeaster_days()
function which returns the numbers of days Easter is from March 21:Outputs: