Source of: /manual/en/function.date-parse.php
<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/ref.datetime.inc";
$setup = array (
'home' =>
array (
0 => 'index.php',
1 => 'PHP Manual',
),
'head' =>
array (
0 => 'UTF-8',
1 => 'en',
),
'this' =>
array (
0 => 'function.date-parse.php',
1 => 'date_parse',
),
'up' =>
array (
0 => 'ref.datetime.php',
1 => 'Date/Time Functions',
),
'prev' =>
array (
0 => 'function.date-parse-from-format.php',
1 => 'date_parse_from_format',
),
'next' =>
array (
0 => 'function.date-sub.php',
1 => 'date_sub',
),
);
$setup["toc"] = $TOC;
$setup["parents"] = $PARENTS;
manual_setup($setup);
manual_header();
?>
<div id="function.date-parse" class="refentry">
<div class="refnamediv">
<h1 class="refname">date_parse</h1>
<p class="verinfo">(PHP 5 >= 5.2.0)</p><p class="refpurpose"><span class="refname">date_parse</span> — <span class="dc-title">Returns associative array with detailed info about given date</span></p>
</div>
<a name="function.date-parse.description"></a><div class="refsect1 description">
<h3 class="title">Description</h3>
<div class="methodsynopsis dc-description">
<span class="type">array</span> <span class="methodname"><b>date_parse</b></span>
( <span class="methodparam"><span class="type">string</span> <tt class="parameter">$date</tt></span>
)</div>
</div>
<a name="function.date-parse.parameters"></a><div class="refsect1 parameters">
<h3 class="title">Parameters</h3>
<p class="para">
</p><dl>
<dt class="varlistentry">
<span class="term"><i><tt class="parameter">date</tt></i>
</span>
</dt><dd class="listitem">
<p class="para">
Date in format accepted by <a href="function.strtotime.php" class="function">strtotime()</a>.
</p>
</dd>
</dl>
<p>
</p>
</div>
<a name="function.date-parse.returnvalues"></a><div class="refsect1 returnvalues">
<h3 class="title">Return Values</h3>
<p class="para">
Returns <a href="language.types.array.php" class="type array">array</a> with information about the parsed date
on success or <b><tt class="constant">FALSE</tt></b> on failure.
</p>
</div>
<a name="function.date-parse.errors"></a><div class="refsect1 errors">
<h3 class="title">Errors/Exceptions</h3>
<p class="para">
In case the date format has an error, the element 'errors' will
contains the error messages.
</p>
</div>
<a name="function.date-parse.examples"></a><div class="refsect1 examples">
<h3 class="title">Examples</h3>
<p class="para">
</p><div class="example">
<p><b>Example #1 A <b>date_parse()</b> example</b></p>
<div class="example-contents programlisting">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB"><?php<br />print_r</span><span style="color: #007700">(</span><span style="color: #0000BB">date_parse</span><span style="color: #007700">(</span><span style="color: #DD0000">"2006-12-12 10:00:00.5"</span><span style="color: #007700">));<br /></span><span style="color: #0000BB">?></span>
</span>
</code></div>
</div>
<div class="example-contents para"><p>The above example will output:</p></div>
<div class="example-contents screen">
<div class="cdata"><pre>
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] =>
)
</pre></div>
</div>
</div><p>
</p>
</div>
<a name="function.date-parse.seealso"></a><div class="refsect1 seealso">
<h3 class="title">See Also</h3>
<p class="para">
</p><ul class="simplelist">
<li class="member"><a href="function.getdate.php" class="function" rel="rdfs-seeAlso">getdate()</a> - Get date/time information</li>
</ul><p>
</p>
</div>
</div><?php manual_footer(); ?>