PHP easter_days() Function

In this chapter you will learn:

  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

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

ParameterIs RequiredDescription
yearOptional.Selected a year. Default is the current year, local time.
methodOptional.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:

  1. Definition for PHP frenchtojd() Function
  2. Syntax for PHP frenchtojd() Function
  3. Parameter for PHP frenchtojd() Function
  4. Example - Convert a French Republican date to a Julian Day Count and back to a French Republican date
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