w3resource

PHP: easter_date() function

Get Unix timestamp for midnight on Easter of a given year

The easter_date() returns the Unix timestamp corresponding to midnight on Easter for the given year.
If you want to calculate Easter before 1970 or after 2037 (i.e. Unix timestamps) use easter_days() instead of easter_date().

Version:

(PHP 4 and above)

Syntax:

easter_date (year)

Parameters:

Name Description Required /
Optional
Type
year The year as number between 1970 to 2037 Optional Integer

Return value:

The easter date as a unix timestamp.

Value Type: Integer.

Example:

<?php
$date = easter_date (2005);
echo (date('M, d', $date).'<br />');
echo (date("M-d-Y",easter_date(2008)).'<br />');
echo (date("M-d-Y",easter_date(2007)) . '<br />');
echo (date("M-d-Y",easter_date(2006)) . '<br />');
?>

Sample Output:

Mar, 26
Mar-22-2008
Apr-07-2007
Apr-15-2006

View the example in the browser

See also

PHP Function Reference

Previous: cal_to_jd
Next: easter_days



Become a Patron!

Follow us on Facebook and Twitter for latest update.

It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.

https://www.w3resource.com/php/function-reference/easter_date.php