PHP easter_days() Function
Example
Output the number of days between Easter and March 21 of different years:
<?php echo "Easter is after March 21 this year."; easter_days() . " Days.<br />"; echo "Easter is after March 21, 1949."; easter_days() . " Days.<br />"; echo "Easter is after March 21, 1980."; easter_days() . " Days.<br />"; echo "Easter is after March 21, 2016."; easter_days() . " Days.<br />"; ?>
Definition and Usage
easter_days() returns the number of days between Easter and March 21 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 date of Easter in numerical form. If omitted, the current year and local time are used by default. |
method |
Optional. Allows you to calculate the date of Easter for 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 21 of the specified year. |
---|---|
PHP Version: | 4+ |
Update Log: | In PHP 4.3,year The parameter is optional,method The parameter is newly added. |