document strptime()

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@169854 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Nuno Lopes 2004-10-03 15:53:48 +00:00
parent 2ef40890c3
commit c77bf3429d
2 changed files with 146 additions and 6 deletions

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.14 $ -->
<!-- $Revision: 1.15 $ -->
<!-- splitted from ./en/functions/datetime.xml, last change in rev 1.2 -->
<refentry id="function.strftime">
<refnamediv>
@ -329,9 +329,10 @@ echo "1/3/2005 - %V,%G,%Y = " . strftime("%V,%G,%Y",strtotime("1/3/2005")) . "\n
</para>
<para>
See also <function>setlocale</function>,
<function>mktime</function>, and the <ulink url="&spec.strftime;">
Open Group specification of
<function>strftime</function></ulink>.
<function>mktime</function>,
<function>strptime</function>,
and the <ulink url="&spec.strftime;">
Open Group specification of <function>strftime</function></ulink>.
</para>
</refsect1>
</refentry>

View file

@ -1,5 +1,5 @@
<?xml version='1.0' encoding='iso-8859-1'?>
<!-- $Revision: 1.1 $ -->
<!-- $Revision: 1.2 $ -->
<refentry id="function.strptime">
<refnamediv>
<refname>strptime</refname>
@ -14,9 +14,148 @@
<methodparam><type>string</type><parameter>timestamp</parameter></methodparam>
<methodparam><type>string</type><parameter>format</parameter></methodparam>
</methodsynopsis>
<para>
<function>strptime</function> returns an array with the
<parameter>timestamp</parameter> parsed, or &false; on error.
</para>
<para>
Month and weekday names and other language dependent strings respect the
current locale set with <function>setlocale</function> (LC_TIME).
</para>
</refsect1>
&warn.undocumented.func;
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>timestamp</parameter> (<type>string</type>)</term>
<listitem>
<para>
A timestamp (e.g. returned from <function>strftime</function>)
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>format</parameter> (<type>string</type>)</term>
<listitem>
<para>
The format used in <parameter>timestamp</parameter> (e.g. the same as
used in <function>strftime</function>).
</para>
<para>
For more information about the format options, read the
<function>strftime</function> page.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns an array, or &false; on failure.
</para>
<para>
<table>
<title>The following parameters are returned in the array</title>
<tgroup cols="2">
<thead>
<row>
<entry>parameters</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry>tm_sec</entry>
<entry>Seconds after the minute (0-61)</entry>
</row>
<row>
<entry>tm_min</entry>
<entry>Minutes after the hour (0-59)</entry>
</row>
<row>
<entry>tm_hour</entry>
<entry>Hour since midnight (0-23)</entry>
</row>
<row>
<entry>tm_mday</entry>
<entry>Day of the month (1-31)</entry>
</row>
<row>
<entry>tm_mon</entry>
<entry>Months since January (0-11)</entry>
</row>
<row>
<entry>tm_year</entry>
<entry>Years since 1900</entry>
</row>
<row>
<entry>tm_wday</entry>
<entry>Days since Sunday (0-6)</entry>
</row>
<row>
<entry>tm_yday</entry>
<entry>Days since January 1 (0-365)</entry>
</row>
</tbody>
</tgroup>
</table>
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>strptime</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$format = '%d/%m/%Y %H:%M:%S';
$strf = strftime($format);
echo "$strf\n";
print_r(strptime($strf, $format));
?>
]]>
</programlisting>
&example.outputs.similar;
<screen>
<![CDATA[
03/10/2004 15:54:19
Array
(
[tm_sec] => 19
[tm_min] => 54
[tm_hour] => 15
[tm_mday] => 3
[tm_mon] => 9
[tm_year] => 104
[tm_wday] => 0
[tm_yday] => 276
[unparsed] =>
)
]]>
</screen>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>strftime</function></member>
</simplelist>
</para>
&note.no-windows;
</refsect1>
</refentry>