PHP easter_date() Function
Example
Output the Easter date for different years:
<?php echo easter_date() . "<br />"; echo date("M-d-Y",easter_date()) . "<br />"; echo date("M-d-Y",easter_date(1980)) . "<br />"; echo date("M-d-Y",easter_date(1984)) . "<br />"; echo date("M-d-Y",easter_date(2016)); ?>
Definition and Usage
The easter_date() function returns the Unix timestamp of Easter midnight for the specified year.
Tip:The date of Easter is defined as the first Sunday after the full moon following the spring equinox (March 21st).
Syntax
easter_date(year);
Parameters | Description |
---|---|
year | Optional. Define the year used to calculate the Easter date (between 1970 and 2037). If omitted, the current year, local time, is used by default. |
Technical Details
Return Value: | Returns the Unix timestamp of the Easter date. |
---|---|
PHP Version: | 4+ |
Update Log: | In PHP 4.3,year Parameter change is optional. |