Curriculum
Course: PHP Basic
Login

Curriculum

PHP Basic

PHP Install

0/1

PHP Casting

0/1

PHP Constants

0/1

PHP Magic Constants

0/1

PHP Operators

0/1

PHP Reference

0/276
Text lesson

easter_date()

Example

Display the Easter date for various years.

<?php
echo easter_date() . “<br />”;
echo date(“M-d-Y”,easter_date()) . “<br />”;
echo date(“M-d-Y”,easter_date(1975)) . “<br />”;
echo date(“M-d-Y”,easter_date(1998)) . “<br />”;
echo date(“M-d-Y”,easter_date(2007));
?>

Definition and Usage

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

Tip: Easter Sunday is determined as the Sunday following the first full moon that occurs on or after the Spring Equinox (March 21st).

Syntax

easter_date(year);

Parameter Values

Parameter

Description

year

(Optional) Specifies a year between 1970 and 2037. If not provided, the default is the current year based on local time.

Technical Details

 

Return Value:

Returns the Unix timestamp for the date of Easter.

PHP Version:

4+

Changelog:

As of PHP 4.3, the year parameter became optional.