mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-23 12:28:55 +00:00

Closes GH-185. git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@352143 c90b9560-bf6c-de11-be94-00142212c4b1
189 lines
4.1 KiB
XML
189 lines
4.1 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!-- $Revision$ -->
|
|
<refentry xml:id="function.date-parse" xmlns="http://docbook.org/ns/docbook">
|
|
<refnamediv>
|
|
<refname>date_parse</refname>
|
|
<refpurpose>Returns associative array with detailed info about given date/time</refpurpose>
|
|
</refnamediv>
|
|
<refsect1 role="description">
|
|
&reftitle.description;
|
|
<methodsynopsis>
|
|
<type>array</type><methodname>date_parse</methodname>
|
|
<methodparam><type>string</type><parameter>datetime</parameter></methodparam>
|
|
</methodsynopsis>
|
|
</refsect1>
|
|
|
|
<refsect1 role="parameters">
|
|
&reftitle.parameters;
|
|
<para>
|
|
<variablelist>
|
|
<varlistentry>
|
|
<term><parameter>datetime</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
Date/time in format accepted by
|
|
<function>DateTimeImmutable::__construct</function>.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
</variablelist>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="returnvalues">
|
|
&reftitle.returnvalues;
|
|
<para>
|
|
Returns <type>array</type> with information about the parsed date/time
|
|
on success&return.falseforfailure;.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="errors">
|
|
&reftitle.errors;
|
|
<para>
|
|
In case the date/time format has an error, the element 'errors' will
|
|
contains the error messages.
|
|
</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>A <function>date_parse</function> example</title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
print_r(date_parse("2006-12-12 10:00:00.5"));
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
&example.outputs;
|
|
<screen>
|
|
<![CDATA[
|
|
Array
|
|
(
|
|
[year] => 2006
|
|
[month] => 12
|
|
[day] => 12
|
|
[hour] => 10
|
|
[minute] => 0
|
|
[second] => 0
|
|
[fraction] => 0.5
|
|
[warning_count] => 0
|
|
[warnings] => Array()
|
|
[error_count] => 0
|
|
[errors] => Array()
|
|
[is_localtime] =>
|
|
)
|
|
]]>
|
|
</screen>
|
|
</example>
|
|
</para>
|
|
<para>
|
|
<link linkend="datetime.formats.relative">Relative formats</link> do not
|
|
influence the values parsed from absolute formats, but are parsed into the
|
|
"relative" element.
|
|
<example>
|
|
<title><function>date_parse</function> with relative formats</title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
print_r(date_parse("2006-12-12 10:00:00.5 +1 week +1 hour"));
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
&example.outputs;
|
|
<screen>
|
|
<![CDATA[
|
|
Array
|
|
(
|
|
[year] => 2006
|
|
[month] => 12
|
|
[day] => 12
|
|
[hour] => 10
|
|
[minute] => 0
|
|
[second] => 0
|
|
[fraction] => 0.5
|
|
[warning_count] => 0
|
|
[warnings] => Array
|
|
(
|
|
)
|
|
|
|
[error_count] => 0
|
|
[errors] => Array
|
|
(
|
|
)
|
|
|
|
[is_localtime] =>
|
|
[relative] => Array
|
|
(
|
|
[year] => 0
|
|
[month] => 0
|
|
[day] => 7
|
|
[hour] => 1
|
|
[minute] => 0
|
|
[second] => 0
|
|
)
|
|
|
|
)]]>
|
|
</screen>
|
|
</example>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="seealso">
|
|
&reftitle.seealso;
|
|
<para>
|
|
<simplelist>
|
|
<member><function>checkdate</function></member>
|
|
<member><function>getdate</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
|
|
-->
|