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 default is the current year, local time. |
Technical details
Return value: | Return the Unix timestamp of the Easter date. |
---|---|
PHP version: | 4+ |
Update log: | In PHP 4.3 ,year Parameter change is optional. |