PHP easter_days() Function

Example

Output the number of days between Easter and March 21st for different years:

<?php
echo "Easter is after March 21st this year."; easter_days() . " Days.<br />";
echo "Easter is after March 21st, 1949."; easter_days() . " Days.<br />";
echo "Easter is after March 21st, 1980."; easter_days() . " Days.<br />";
echo "Easter is after March 21st, 2016."; easter_days() . " Days.<br />";
?>

Run Example

Definition and Usage

easter_days() returns the number of days between Easter and March 21st of the specified year.

Tip:The date of Easter is defined as the first Sunday after the full moon following the spring equinox (March 21st) each year.

Syntax

easter_days(year,method);
Parameter Description
year Optional. Specifies the year used to calculate the Easter date as a number. If omitted, the current year and local time are used by default.
method

Optional. Allows you to calculate the Easter date of other calendars.

For example, if set to CAL_EASTER_ROMAN, the Gregorian calendar from 1582 to 1752 is used.

Technical Details

Return Value: Returns the number of days between Easter and March 21st of the specified year.
PHP Version: 4+
Update Log: In PHP 4.3,year The parameter is optional,method The parameter is newly added.