PHP easter_date()Functions

PHP Calendar 参考手册PHP Calendar Reference Manual

Examples

Output the Easter dates for different years:

<?php
echo easter_date() . "<br />";
echo date("M-d-Y",easter_date()) . "<br />";
echo date("M-d-Y",easter_date(1975)) . "<br />";
echo date("M-d-Y",easter_date(1998)) . "<br />";
echo date("M-d-Y",easter_date(2007));
?>

Run Example »

Definition and Usage

The easter_date() function returns the Unix timestamp for midnight of Easter of the specified year.

Tip:The date of Easter is defined as the first Sunday after the first full moon on or after the vernal equinox (March 21) each year.

Syntax

easter_date(year);

Parameter Description
year Optional. Defines the year (between 1970 and 2037) used to calculate the Easter date. If omitted, the current year is used by default, local time.

Technical Details

Return value: Returns the Unix timestamp of the Easter date.
PHP Version: 4+
Changelog: In PHP 4.3,yearthe parameter is optional.


PHP Calendar 参考手册PHP Calendar Reference Manual Other Extensions