php-doc-en/reference/datetime/functions/date-parse-from-format.xml
Christoph Michael Becker a59ed9b526 Updates for datetime extension
Patch contributed by derick@

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@350219 c90b9560-bf6c-de11-be94-00142212c4b1
2020-07-27 11:47:54 +00:00

153 lines
3.5 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="function.date-parse-from-format" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>date_parse_from_format</refname>
<refpurpose>Get info about given date formatted according to the specified format</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>array</type><methodname>date_parse_from_format</methodname>
<methodparam><type>string</type><parameter>format</parameter></methodparam>
<methodparam><type>string</type><parameter>datetime</parameter></methodparam>
</methodsynopsis>
<para>
Returns associative array with detailed info about given date/time.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>format</parameter></term>
<listitem>
<para>
Format accepted by <function>DateTime::createFromFormat</function>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>datetime</parameter></term>
<listitem>
<para>
String representing the date/time.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<!-- See also &return.success; -->
<para>
Returns associative array with detailed info about given date/time.
</para>
</refsect1>
<refsect1 role="changelog">
&reftitle.changelog;
<informaltable>
<tgroup cols="2">
<thead>
<row>
<entry>&Version;</entry>
<entry>&Description;</entry>
</row>
</thead>
<tbody>
<row>
<entry>7.2.0</entry>
<entry>
The <literal>zone</literal> element of the returned array represents
seconds instead of minutes now, and its sign is inverted. For instance
<literal>-120</literal> is now <literal>7200</literal>.
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>date_parse_from_format</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$date = "6.1.2009 13:00+01:00";
print_r(date_parse_from_format("j.n.Y H:iP", $date));
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
Array
(
[year] => 2009
[month] => 1
[day] => 6
[hour] => 13
[minute] => 0
[second] => 0
[fraction] =>
[warning_count] => 0
[warnings] => Array
(
)
[error_count] => 0
[errors] => Array
(
)
[is_localtime] => 1
[zone_type] => 1
[zone] => 3600
[is_dst] =>
)
]]>
</screen>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>DateTime::createFromFormat</function></member>
<member><function>checkdate</function></member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->