reference/datetime/functions/strptime.xml
c9490d424ec11a4fe92f07f08cff95c85c7d22df
...
...
@@ -1,22 +1,28 @@
1
1
<?xml version="1.0" encoding="utf-8"?>
2
2
<!-- $Revision$ -->
3
-
<refentry xml:id="function.strptime" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
3
+
<refentry xml:id="function.strptime" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
4
4
<refnamediv>
5
5
<refname>strptime</refname>
6
6
<refpurpose>
7
7
Parse a time/date generated with <function>strftime</function>
8
8
</refpurpose>
9
9
</refnamediv>
10
+

11
+
<refsynopsisdiv>
12
+
&warn.deprecated.function-8-1-0;
13
+
</refsynopsisdiv>
14
+
10
15
<refsect1 role="description">
11
16
&reftitle.description;
12
17
<methodsynopsis>
13
-
<type>array</type><methodname>strptime</methodname>
14
-
<methodparam><type>string</type><parameter>date</parameter></methodparam>
15
-
<methodparam><type>string</type><parameter>format</parameter></methodparam>
16
-
</methodsynopsis>
18
+
<modifier role="attribute">#[\Deprecated]</modifier>
19
+
<type class="union"><type>array</type><type>false</type></type><methodname>strptime</methodname>
20
+
<methodparam><type>string</type><parameter>timestamp</parameter></methodparam>
21
+
<methodparam><type>string</type><parameter>format</parameter></methodparam>
22
+
</methodsynopsis>
17
23
<para>
18
24
<function>strptime</function> returns an array with the
19
-
<parameter>date</parameter> parsed, or &false; on error.
25
+
<parameter>timestamp</parameter> parsed, or &false; on error.
20
26
</para>
21
27
<para>
22
28
Month and weekday names and other language dependent strings respect the
...
...
@@ -29,7 +35,7 @@
29
35
<para>
30
36
<variablelist>
31
37
<varlistentry>
32
-
<term><parameter>date</parameter> (<type>string</type>)</term>
38
+
<term><parameter>timestamp</parameter> (<type>string</type>)</term>
33
39
<listitem>
34
40
<para>
35
41
The string to parse (e.g. returned from <function>strftime</function>).
...
...
@@ -40,7 +46,7 @@
40
46
<term><parameter>format</parameter> (<type>string</type>)</term>
41
47
<listitem>
42
48
<para>
43
-
The format used in <parameter>date</parameter> (e.g. the same as
49
+
The format used in <parameter>timestamp</parameter> (e.g. the same as
44
50
used in <function>strftime</function>). Note that some of the format
45
51
options available to <function>strftime</function> may not have any
46
52
effect within <function>strptime</function>; the exact subset that are
...
...
@@ -108,7 +114,7 @@
108
114
</row>
109
115
<row>
110
116
<entry><literal>"unparsed"</literal></entry>
111
-
<entry>the <parameter>date</parameter> part which was not
117
+
<entry>the <parameter>timestamp</parameter> part which was not
112
118
recognized using the specified <parameter>format</parameter></entry>
113
119
</row>
114
120
</tbody>
...
...
@@ -118,9 +124,35 @@
118
124

119
125
</refsect1>
120
126

121
-
<refsect1 role="examples">
122
-
&reftitle.examples;
123
-
<para>
127
+
<refsect1 role="changelog">
128
+
&reftitle.changelog;
129
+
<para>
130
+
<informaltable>
131
+
<tgroup cols="2">
132
+
<thead>
133
+
<row>
134
+
<entry>&Version;</entry>
135
+
<entry>&Description;</entry>
136
+
</row>
137
+
</thead>
138
+
<tbody>
139
+
<row>
140
+
<entry>8.1.0</entry>
141
+
<entry>
142
+
This function has been deprecated.
143
+
Use <function>date_parse_from_format</function> instead (for locale-independent parsing),
144
+
or <methodname>IntlDateFormatter::parse</methodname> (for locale-dependent parsing)
145
+
</entry>
146
+
</row>
147
+
</tbody>
148
+
</tgroup>
149
+
</informaltable>
150
+
</para>
151
+
</refsect1>
152
+

153
+
<refsect1 role="examples">
154
+
&reftitle.examples;
155
+
<para>
124
156
<example>
125
157
<title><function>strptime</function> example</title>
126
158
<programlisting role="php">
...
...
@@ -134,9 +166,9 @@ echo "$strf\n";
134
166
print_r(strptime($strf, $format));
135
167
?>
136
168
]]>
137
-
</programlisting>
138
-
&example.outputs.similar;
139
-
<screen>
169
+
</programlisting>
170
+
&example.outputs.similar;
171
+
<screen>
140
172
<![CDATA[
141
173
03/10/2004 15:54:19
142
174

...
...
@@ -153,53 +185,46 @@ Array
153
185
[unparsed] =>
154
186
)
155
187
]]>
156
-
</screen>
157
-
</example>
158
-
</para>
159
-
</refsect1>
160
-

161
-
<refsect1 role="notes">
162
-
&reftitle.notes;
163
-
&note.no-windows;
164
-
<note>
165
-
<para>
166
-
Internally, this function calls the <literal>strptime()</literal>
167
-
function provided by the system's C library. This function can exhibit
168
-
noticeably different behaviour across different operating systems. The
169
-
use of <function>date_parse_from_format</function>, which does not
170
-
suffer from these issues, is recommended on PHP 5.3.0 and later.
171
-
</para>
172
-
</note>
173
-
<note>
174
-
<para>
175
-
<literal>"tm_sec"</literal> includes any leap seconds (currently upto 2
176
-
a year). For more information on leap seconds, see the <link
177
-
xlink:href="&url.wiki.leap-seconds;">Wikipedia article
178
-
on leap seconds</link>.
179
-
</para>
180
-
</note>
181
-
<note>
182
-
<para>
183
-
Prior to PHP 5.2.0, this function could return undefined behaviour. Notably,
184
-
the <literal>"tm_sec"</literal>, <literal>"tm_min"</literal> and <literal>"tm_hour"</literal>
185
-
entries would return undefined values.
186
-
</para>
187
-
</note>
188
-
</refsect1>
188
+
</screen>
189
+
</example>
190
+
</para>
191
+
</refsect1>
189
192

190
-
<refsect1 role="seealso">
191
-
&reftitle.seealso;
192
-
<para>
193
-
<simplelist>
194
-
<member><function>checkdate</function></member>
195
-
<member><function>strftime</function></member>
196
-
<member><function>date_parse_from_format</function></member>
197
-
<member><function>DateTime::createFromFormat</function></member>
198
-
</simplelist>
199
-
</para>
200
-
</refsect1>
201
-
</refentry>
193
+
<refsect1 role="notes">
194
+
&reftitle.notes;
195
+
&note.no-windows;
196
+
<note>
197
+
<para>
198
+
Internally, this function calls the <literal>strptime()</literal>
199
+
function provided by the system's C library. This function can exhibit
200
+
noticeably different behaviour across different operating systems. The
201
+
use of <function>date_parse_from_format</function>, which does not
202
+
suffer from these issues, is recommended.
203
+
</para>
204
+
</note>
205
+
<note>
206
+
<para>
207
+
<literal>"tm_sec"</literal> includes any leap seconds (currently upto 2
208
+
a year). For more information on leap seconds, see the <link
209
+
xlink:href="&url.wiki.leap-seconds;">Wikipedia article
210
+
on leap seconds</link>.
211
+
</para>
212
+
</note>
213
+
</refsect1>
202
214

215
+
<refsect1 role="seealso">
216
+
&reftitle.seealso;
217
+
<para>
218
+
<simplelist>
219
+
<member><methodname>IntlDateFormatter::parse</methodname></member>
220
+
<member><methodname>DateTime::createFromFormat</methodname></member>
221
+
<member><function>checkdate</function></member>
222
+
<member><function>strftime</function></member>
223
+
<member><function>date_parse_from_format</function></member>
224
+
</simplelist>
225
+
</para>
226
+
</refsect1>
227
+
</refentry>
203
228
<!-- Keep this comment at the end of the file
204
229
Local variables:
205
230
mode: sgml
206
231