Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

PHP easter_days() Function

PHP easter_days() Function

PHP Calendar Reference Manual PHP Calendar Reference Manual

Example

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

"; echo "Easter Day was ". easter_days(1990) . " days after March 21 in 1990.
"; echo "Easter Day was ". easter_days(1342) . " days after March 21 in 1342.
"; echo "Easter Day will be ". easter_days(2050) . " days after March 21 in 2050."; ?>

Run Example »


Definition and Usage

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

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

Syntax

easter_days(

year,method);

Parameters Description
year Optional. Defines the year used to calculate the Easter date, as a number. If omitted, the current year in local time is used by default.
method Optional. Allows you to calculate the Easter date for other calendars. For example, if set to CAL_EASTER_ROMAN, the Gregorian calendar for the period 1582 - 1752 is used.

Technical Details

Return Value: Returns the number of days between Easter and March 21 for the specified year.
PHP Version: 4+
Changelog: In PHP 4.3, theyear parameter became optional and themethod parameter was added.

PHP Calendar Reference Manual PHP Calendar Reference Manual