reference/datetime/functions/mktime.xml
349e3c6502e0bbeb15aef2b4a4a25f3f5e10fbfe
...
...
@@ -24,12 +24,22 @@
24
24
specified.
25
25
</para>
26
26
<para>
27
-
Arguments may be left out in order from right to left; any
28
-
arguments thus omitted will be set to the current value according
27
+
Any optional
28
+
arguments omitted or &null; will be set to the current value according
29
29
to the local date and time.
30
30
</para>
31
+
<warning>
32
+
<para>
33
+
Please note that the ordering of arguments is in an odd order:
34
+
<parameter>month</parameter>, <parameter>day</parameter>,
35
+
<parameter>year</parameter>, and not in the more reasonable order of
36
+
<parameter>year</parameter>, <parameter>month</parameter>,
37
+
<parameter>day</parameter>.
38
+
</para>
39
+
</warning>
31
40
<simpara>
32
-
Calling <function>mktime</function> without arguments is deprecated.
41
+
Calling <function>mktime</function> without arguments is not supported,
42
+
and will result in an <classname>ArgumentCountError</classname>.
33
43
<function>time</function> can be used to get the current timestamp.
34
44
</simpara>
35
45
</refsect1>
...
...
@@ -112,16 +122,10 @@
112
122
&reftitle.returnvalues;
113
123
<para>
114
124
<function>mktime</function> returns the Unix timestamp of the arguments
115
-
given.
116
-
If the arguments are invalid, the function returns &false;.
125
+
given, or &false; if the timestamp doesn't fit in a PHP integer.
117
126
</para>
118
127
</refsect1>
119
128

120
-
<refsect1 role="errors">
121
-
&reftitle.errors;
122
-
&date.timezone.errors.description;
123
-
</refsect1>
124
-

125
129
<refsect1 role="changelog">
126
130
&reftitle.changelog;
127
131
<para>
...
...
@@ -137,7 +141,8 @@
137
141
<row>
138
142
<entry>8.0.0</entry>
139
143
<entry>
140
-
<parameter>hour</parameter> is no longer optional.
144
+
<parameter>hour</parameter> is no longer optional. If you need a Unix
145
+
timestamp, use <function>time</function>.
141
146
</entry>
142
147
</row>
143
148
<row>
...
...
@@ -206,10 +211,13 @@ echo date("M-d-Y", mktime(0, 0, 0, 1, 1, 98));
206
211
<programlisting role="php">
207
212
<![CDATA[
208
213
<?php
214
+

209
215
$lastday = mktime(0, 0, 0, 3, 0, 2000);
210
-
echo strftime("Last day in Feb 2000 is: %d", $lastday);
216
+
echo 'Last day in Feb 2000 is: ', date('d', $lastday);
217
+

211
218
$lastday = mktime(0, 0, 0, 4, -31, 2000);
212
-
echo strftime("Last day in Feb 2000 is: %d", $lastday);
219
+
echo 'Last day in Feb 2000 is: ', date('d', $lastday);
220
+

213
221
?>
214
222
]]>
215
223
</programlisting>
...
...
@@ -221,6 +229,7 @@ echo strftime("Last day in Feb 2000 is: %d", $lastday);
221
229
&reftitle.seealso;
222
230
<para>
223
231
<simplelist>
232
+
<member>The <classname>DateTimeImmutable</classname> class</member>
224
233
<member><function>checkdate</function></member>
225
234
<member><function>gmmktime</function></member>
226
235
<member><function>date</function></member>
227
236