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_days()

Example

Display the number of days after March 21 that Easter Sunday falls/fell on for various 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.”;
?>

Definition and Usage

The easter_days() function returns the number of days after March 21 that Easter Sunday occurs in a given year.

 

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

Syntax

easter_days(year,method);

Parameter Values

Parameter

Description

year

(Optional) Specifies the year as a number. If not provided, the default is the current year according to local time.

method

(Optional) Allows for calculating Easter dates based on different calendars. For example, setting it to CAL_EASTER_ROMAN uses the Gregorian calendar for the years 1582 to 1752.

Technical Details

 

Return Value:

Returns the number of days after March 21 that Easter Sunday falls in the specified year.

PHP Version:

4+

Changelog:

Starting with PHP 4.3, the year parameter became optional, and a method parameter was introduced.