easter_date
Description
The easter_date of Calendar for PHP gets the Unix timestamp for midnight on Easter of a given year.
Syntax
easter_date( ?int $year = null, int $mode = CAL_EASTER_DEFAULT ): int
Parameters
year
The year as a number between 1970 an 2037. If omitted or null, defaults to the current year according to the local time.
method
Allows Easter dates to be calculated based on a spedified calendar.
Value | Constant | Description |
---|---|---|
0 | CAL_EASTER_DEFAULT | Calculate Easter for years before 1753 according to the Julian calendar and for later years according to the Gregorian calendar. |
1 | CAL_EASTER_ROMAN | Calculate Easter for years before 1583 according to the Julian calendar and for later years according to the Gregorian calendar. |
2 | CAL_EASTER_ALWAYS_GREGORIAN | Calculate Easter according to the proleptic Gregorian calendar. |
3 | CAL_EASTER_ALWAYS_JULIAN | Calculate Easter according to the Julian calendar. |
Return
Returns the easter date as a unix timestamp.
Examples
1 · Jesus
<? echo "\"Don't be alarmed,\" he said. \"You are looking for Jesus the Nazarene, who was crucified. He has risen! He is not here. See the place where they laid him. Mark 16:6"; echo "\n\n<br><br>Jesus, who lived a perfect life, died for our sins. He rose from the grave and offers us eternal life with Him in heaven. All we have to do is confess Jesus is Lord and believe God raised Him from the dead and we will be saved. Happy Easter!"; ?>
"Don't be alarmed," he said. "You are looking for Jesus the Nazarene, who was crucified. He has risen! He is not here. See the place where they laid him. Mark 16:6 <br><br>Jesus, who lived a perfect life, died for our sins. He rose from the grave and offers us eternal life with Him in heaven. All we have to do is confess Jesus is Lord and believe God raised Him from the dead and we will be saved. Happy Easter!
2 · void
<? $return = easter_date(); echo $return . PHP_EOL; echo date("Y-m-d", $return); ?>
1711843200 2024-03-31
3 · year
<? $year = 1970; $return = easter_date($year); echo $return . PHP_EOL; echo date("Y-m-d", $return); ?>
7516800 1970-03-29
4 · method · CAL_EASTER_DEFAULT
<? $year = 1970; $method = CAL_EASTER_DEFAULT; $return = easter_date($year, $method); echo $return . PHP_EOL; echo date("Y-m-d", $return); ?>
7516800 1970-03-29
5 · method · CAL_EASTER_ROMAN
<? $year = 1970; $method = CAL_EASTER_ROMAN; $return = easter_date($year, $method); echo $return . PHP_EOL; echo date("Y-m-d", $return); ?>
7516800 1970-03-29
6 · method · CAL_EASTER_ALWAYS_GREGORIAN
<? $year = 1970; $method = CAL_EASTER_ALWAYS_GREGORIAN; $return = easter_date($year, $method); echo $return . PHP_EOL; echo date("Y-m-d", $return); ?>
7516800 1970-03-29
7 · method · CAL_EASTER_ALWAYS_JULIAN
<? $year = 1970; $method = CAL_EASTER_ALWAYS_JULIAN; $return = easter_date($year, $method); echo $return . PHP_EOL; echo date("Y-m-d", $return); ?>
8812800 1970-04-13