PHP easter_date() Function

In this chapter you will learn:

  1. Definition for PHP easter_date() Function
  2. Syntax for PHP easter_date() Function
  3. Parameter for PHP easter_date() Function
  4. Return value from PHP easter_date() Function
  5. Example - Print the easter date for different years

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//from 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.

Next chapter...

What you will learn in the next chapter:

  1. Definition for PHP easter_days() Function
  2. Syntax for PHP easter_days() Function
  3. Parameter for PHP easter_days() Function
  4. Return value from PHP easter_days() Function
  5. Example - Print the number of days after March 21, that the Easter Day is/was for different years
Home » PHP Tutorial » PHP Calendar Functions
PHP 5 Predefined Calendar Constants
PHP cal_days_in_month() Function
PHP cal_from_jd() Function
PHP cal_info() Function
PHP cal_to_jd() Function
PHP easter_date() Function
PHP easter_days() Function
PHP frenchtojd() Function
PHP gregoriantojd() Function
PHP jddayofweek() Function
PHP jdmonthname() Function
PHP jdtofrench() Function
PHP jdtogregorian() Function
PHP jdtojewish() Function
PHP jdtojulian() Function
PHP jdtounix() Function
PHP jewishtojd() Function
PHP juliantojd() Function
PHP unixtojd() Function