Menu Home

easter_date

osbo.com | PHP | Functions | easter_date

Get Unix timestamp for midnight on Easter of a given year

Syntax

easter_date ([ int $year = date("Y") [, int $method = CAL_EASTER_DEFAULT ]] ) : int

Parameters

year

The year as a number between 1970 an 2037. If omitted, defaults to the current year according to the local time.

method

Allows Easter dates to be calculated based on a spedified calendar.

Number Name 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

The easter date as a unix timestamp.

Examples

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. 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. Happy Easter!

void

<?

$return = easter_date();

echo $return . PHP_EOL;
echo date("Y-m-d", $return);

?>
1617519600
2021-04-04

year

<?

$year = 1970;

$return = easter_date($year);

echo $return . PHP_EOL;
echo date("Y-m-d", $return);

?>
7542000
1970-03-29

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);

?>
7542000
1970-03-29

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);

?>
7542000
1970-03-29

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);

?>
7542000
1970-03-29

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);

?>
8838000
1970-04-13

PHP