reference/calendar/functions/easter-date.xml
a0fcdcb58023bd4cb017fdba511df29b9f7a25f5
...
...
@@ -10,20 +10,13 @@
10
10
&reftitle.description;
11
11
<methodsynopsis>
12
12
<type>int</type><methodname>easter_date</methodname>
13
-
<methodparam choice="opt"><type>int</type><parameter>year</parameter><initializer>date("Y")</initializer></methodparam>
14
-
<methodparam choice="opt"><type>int</type><parameter>method</parameter><initializer>CAL_EASTER_DEFAULT</initializer></methodparam>
13
+
<methodparam choice="opt"><type class="union"><type>int</type><type>null</type></type><parameter>year</parameter><initializer>&null;</initializer></methodparam>
14
+
<methodparam choice="opt"><type>int</type><parameter>mode</parameter><initializer><constant>CAL_EASTER_DEFAULT</constant></initializer></methodparam>
15
15
</methodsynopsis>
16
16
<para>
17
17
Returns the Unix timestamp corresponding to midnight on Easter of
18
18
the given year.
19
19
</para>
20
-
<warning>
21
-
<para>
22
-
This function will generate a warning if the year is outside
23
-
of the range for Unix timestamps (i.e. typically before 1970 or after 2037
24
-
on 32bit systems).
25
-
</para>
26
-
</warning>
27
20
<para>
28
21
The date of Easter Day was defined by the Council of Nicaea in
29
22
AD325 as the Sunday after the first full moon which falls on or
...
...
@@ -49,13 +42,13 @@
49
42
<term><parameter>year</parameter></term>
50
43
<listitem>
51
44
<para>
52
-
The year as a number between 1970 an 2037. If omitted, defaults to the
53
-
current year according to the local time.
45
+
The year must be a number between 1970 and 2037 for 32-bit systems, or between 1970 and 2,000,000,000 for 64-bit systems.
46
+
If omitted or &null;, defaults to the current year according to the local time.
54
47
</para>
55
48
</listitem>
56
49
</varlistentry>
57
50
<varlistentry>
58
-
<term><parameter>method</parameter></term>
51
+
<term><parameter>mode</parameter></term>
59
52
<listitem>
60
53
<para>
61
54
Allows Easter dates to be calculated based on the Julian calendar when set
...
...
@@ -75,6 +68,51 @@
75
68
</para>
76
69
</refsect1>
77
70

71
+
<refsect1 role="errors">
72
+
&reftitle.errors;
73
+
<para>
74
+
A <classname>ValueError</classname> is thrown if the year is earlier than 1970 or later than 2037
75
+
when running on a 32-bit system, or later than 2,000,000,000 on a 64-bit system.
76
+
</para>
77
+
</refsect1>
78
+

79
+
<refsect1 role="changelog">
80
+
&reftitle.changelog;
81
+
<informaltable>
82
+
<tgroup cols="2">
83
+
<thead>
84
+
<row>
85
+
<entry>&Version;</entry>
86
+
<entry>&Description;</entry>
87
+
</row>
88
+
</thead>
89
+
<tbody>
90
+
<row>
91
+
<entry>8.3.0</entry>
92
+
<entry>
93
+
On 64-bit systems, the <parameter>year</parameter> parameter now accepts values within the range of 1970 to 2,000,000,000.
94
+
</entry>
95
+
</row>
96
+
<row>
97
+
<entry>8.0.0</entry>
98
+
<entry>
99
+
<parameter>year</parameter> is nullable now.
100
+
</entry>
101
+
</row>
102
+
<row>
103
+
<entry>8.0.0</entry>
104
+
<entry>
105
+
A <classname>ValueError</classname> is now thrown when
106
+
<parameter>year</parameter> is outside the allowed range.
107
+
Previously, an <constant>E_WARNING</constant> was raised
108
+
and the function returned &false;.
109
+
</entry>
110
+
</row>
111
+
</tbody>
112
+
</tgroup>
113
+
</informaltable>
114
+
</refsect1>
115
+

78
116
<refsect1 role="examples">
79
117
&reftitle.examples;
80
118
<para>
...
...
@@ -92,6 +130,24 @@ echo date("M-d-Y", easter_date(2001)); // Apr-15-2001
92
130
]]>
93
131
</programlisting>
94
132
</example>
133
+

134
+
<example>
135
+
<title>Using <function>easter_date</function> with <classname>DateTime</classname></title>
136
+
<programlisting role="php">
137
+
<![CDATA[
138
+
<?php
139
+

140
+
$timestamp = easter_date(2023);
141
+

142
+
$datetime = new \DateTime();
143
+
$datetime->setTimestamp($timestamp);
144
+

145
+
echo $datetime->format('M-d-Y'); // Apr-09-2023
146
+

147
+
?>
148
+
]]>
149
+
</programlisting>
150
+
</example>
95
151
</para>
96
152
</refsect1>
97
153

...
...
@@ -158,7 +214,6 @@ Easter in 2015 is on April 5
158
214
</refsect1>
159
215

160
216
</refentry>
161
-
162
217
<!-- Keep this comment at the end of the file
163
218
Local variables:
164
219
mode: sgml
165
220