PHP easter_days()Functions

PHP Calendar 参考手册PHP Calendar Reference Manual

Examples

Output the number of days between Easter and March 21 in different years:

<?php
echo "Easter Day is ". easter_days() . " days after March 21 this year.<br />";
echo "Easter Day was ". easter_days(1990) . " days after March 21 in 1990.<br />";
echo "Easter Day was ". easter_days(1342) . " days after March 21 in 1342.<br />";
echo "Easter Day will be ". easter_days(2050) . " days after March 21 in 2050.";
?>

Run example »

Definition and Usage

easter_days() returns the number of days between Easter and March 21 in the given year.

Tip:Easter is defined as the first Sunday after the full moon that occurs on or after the vernal equinox (March 21).

Syntax

easter_days(year,method);

Parameters Description
year Optional. Defines the year used to calculate the Easter date, as a number. If omitted, the current year is used by default, based on local time.
method Optional. Allows you to calculate Easter dates in other calendars. For example, if set to CAL_EASTER_ROMAN, the Gregorian calendar is used for the period 1582 - 1752.

Technical Details

Return value: Returns the number of days between Easter and March 21 in the given year.
PHP version: 4+
Changelog: In PHP 4.3,yearthe parameter became optional,methodthe parameter was added.


PHP Calendar 参考手册PHP Calendar Reference Manual Other extensions