PHP easter_days() Function
In this chapter you will learn:
- Definition for PHP easter_days() Function
- Syntax for PHP easter_days() Function
- Parameter for PHP easter_days() Function
- Return value from PHP easter_days() Function
- Example - Print the number of days after March 21, that the Easter Day is/was for different years
Definition
The easter_days() function returns the number of days between March 21 and the Easter Day 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_days() Function has the following syntax.
easter_days(year,method);
Parameter
Parameter | Is Required | Description |
---|---|---|
year | Optional. | Selected a year. Default is the current year, local time. |
method | Optional. | Calculate easter dates based on other calendars. |
Return
PHP easter_days() Function returns the number of days between March 21 and the Easter Day for a given year.
Example
Print the number of days after March 21, that the Easter Day is/was for different years:
<?php/* j ava2s. c o m*/
echo "Easter Day is ". easter_days() . " days after March 21 this year.\n";
echo "Easter Day was ". easter_days(2011) . " days after March 21 in 2011.\n";
echo "Easter Day was ". easter_days(2012) . " days after March 21 in 2012.\n";
echo "Easter Day will be ". easter_days(2013) . " days after March 21 in 2013.";
?>
The code above generates the following result.
Next chapter...
What you will learn in the next chapter:
- Definition for PHP frenchtojd() Function
- Syntax for PHP frenchtojd() Function
- Parameter for PHP frenchtojd() Function
- Example - Convert a French Republican date to a Julian Day Count and back to a French Republican date
Home » PHP Tutorial » PHP Calendar Functions