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//  w ww . ja v a  2  s.  c  o m
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.





















Home »
  PHP Tutorial »
    Function reference »




PHP Array Functions
PHP Calendar Functions
PHP Class Functions
PHP Data Type Functions
PHP Date Functions
PHP File Functions
PHP Image Functions
PHP Math Functions
PHP MySQLi Functions
PHP SimpleXML Functions
PHP String Functions
PHP XML Functions
PHP Zip Functions