PHP Tutorial - PHP easter_date() Function






Definition

The easter_date() function returns the Unix timestamp for midnight on Easter for a given year.

Easter Day is the Sunday after the first full moon which falls on or after the Spring Equinox (21st March).

Syntax

PHP easter_date() Function has the following syntax.

easter_date(year);

Parameter

Optional year selects a year between 1970 and 2037. Default is the current year, local time.

Return

PHP easter_date() Function returns the easter date as a unix timestamp.





Example

Print the easter date for different years:


<?php
echo easter_date() . "\n";
echo date("M-d-Y",easter_date()) . "\n";
echo date("M-d-Y",easter_date(2010)) . "\n";
echo date("M-d-Y",easter_date(2011)) . "\n";
echo date("M-d-Y",easter_date(2012)) . "\n";
echo date("M-d-Y",easter_date(2013)) . "\n";
?>

The code above generates the following result.