<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <HTML ><HEAD ><TITLE >easter_days</TITLE ><META NAME="GENERATOR" CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK REL="HOME" TITLE="PHP 手册" HREF="index.html"><LINK REL="UP" TITLE="Calendar 日历函数" HREF="ref.calendar.html"><LINK REL="PREVIOUS" TITLE="easter_date" HREF="function.easter-date.html"><LINK REL="NEXT" TITLE="FrenchToJD" HREF="function.frenchtojd.html"><META HTTP-EQUIV="Content-type" CONTENT="text/html; charset=UTF-8"></HEAD ><BODY CLASS="refentry" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#840084" ALINK="#0000FF" ><DIV CLASS="NAVHEADER" ><TABLE SUMMARY="Header navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TH COLSPAN="3" ALIGN="center" >PHP 手册</TH ></TR ><TR ><TD WIDTH="10%" ALIGN="left" VALIGN="bottom" ><A HREF="function.easter-date.html" ACCESSKEY="P" >上一页</A ></TD ><TD WIDTH="80%" ALIGN="center" VALIGN="bottom" ></TD ><TD WIDTH="10%" ALIGN="right" VALIGN="bottom" ><A HREF="function.frenchtojd.html" ACCESSKEY="N" >下一页</A ></TD ></TR ></TABLE ><HR ALIGN="LEFT" WIDTH="100%"></DIV ><H1 ><A NAME="function.easter-days" ></A >easter_days</H1 ><DIV CLASS="refnamediv" ><A NAME="AEN16081" ></A ><P > (PHP 3 >= 3.0.9, PHP 4, PHP 5)</P >easter_days -- Get number of days after March 21 on which Easter falls for a given year </DIV ><DIV CLASS="refsect1" ><A NAME="AEN16084" ></A ><H2 >Description</H2 >int <B CLASS="methodname" >easter_days</B > ( [int year [, int method]] )<BR ></BR ><P > Returns the number of days after March 21 on which Easter falls for a given year. If no year is specified, the current year is assumed. </P ><P > Since PHP 4.3.0, the <CODE CLASS="parameter" >year</CODE > parameter is optional and defaults to the current year according to the localtime if omitted. </P ><P > The <CODE CLASS="parameter" >method</CODE > parameter was also introduced in PHP 4.3.0 and allows to calculate easter dates based on the Gregorian calendar during the years 1582 - 1752 when set to <TT CLASS="constant" ><B >CAL_EASTER_ROMAN</B ></TT >. See the <A HREF="ref.calendar.html#calendar.constants" >calendar constants</A > for more valid constants. </P ><P > This function can be used instead of <A HREF="function.easter-date.html" ><B CLASS="function" >easter_date()</B ></A > to calculate Easter for years which fall outside the range of Unix timestamps (i.e. before 1970 or after 2037). <TABLE WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" CLASS="EXAMPLE" ><TR ><TD ><DIV CLASS="example" ><A NAME="AEN16104" ></A ><P ><B >例 1. <B CLASS="function" >easter_days()</B > example</B ></P ><TABLE BORDER="0" BGCOLOR="#E0E0E0" CELLPADDING="5" ><TR ><TD ><code><font color="#000000"> <font color="#0000BB"><?php<br /><br /></font><font color="#007700">echo </font><font color="#0000BB">easter_days</font><font color="#007700">(</font><font color="#0000BB">1999</font><font color="#007700">); </font><font color="#FF8000">// 14, i.e. April 4<br /></font><font color="#007700">echo </font><font color="#0000BB">easter_days</font><font color="#007700">(</font><font color="#0000BB">1492</font><font color="#007700">); </font><font color="#FF8000">// 32, i.e. April 22<br /></font><font color="#007700">echo </font><font color="#0000BB">easter_days</font><font color="#007700">(</font><font color="#0000BB">1913</font><font color="#007700">); </font><font color="#FF8000">// 2, i.e. March 23<br /><br /></font><font color="#0000BB">?></font> </font> </code></TD ></TR ></TABLE ></DIV ></TD ></TR ></TABLE > </P ><P > The date of Easter Day was defined by the Council of Nicaea in AD325 as the Sunday after the first full moon which falls on or after the Spring Equinox. The Equinox is assumed to always fall on 21st March, so the calculation reduces to determining the date of the full moon and the date of the following Sunday. The algorithm used here was introduced around the year 532 by Dionysius Exiguus. Under the Julian Calendar (for years before 1753) a simple 19-year cycle is used to track the phases of the Moon. Under the Gregorian Calendar (for years after 1753 - devised by Clavius and Lilius, and introduced by Pope Gregory XIII in October 1582, and into Britain and its then colonies in September 1752) two correction factors are added to make the cycle more accurate. </P ><P > (The code is based on a C program by Simon Kershaw, <webmaster at ely.anglican dot org>) </P ><P > See also <A HREF="function.easter-date.html" ><B CLASS="function" >easter_date()</B ></A >. </P ></DIV ><DIV CLASS="NAVFOOTER" ><HR ALIGN="LEFT" WIDTH="100%"><TABLE SUMMARY="Footer navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" ><A HREF="function.easter-date.html" ACCESSKEY="P" >上一页</A ></TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="index.html" ACCESSKEY="H" >起始页</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" ><A HREF="function.frenchtojd.html" ACCESSKEY="N" >下一页</A ></TD ></TR ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" >easter_date</TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="ref.calendar.html" ACCESSKEY="U" >上一级</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" >FrenchToJD</TD ></TR ></TABLE ></DIV ></BODY ></HTML >