<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title>Returns associative array with detailed info about given date</title> </head> <body><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.date-parse-from-format.html">date_parse_from_format</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.date-sub.html">date_sub</a></div> <div class="up"><a href="ref.datetime.html">Date/Time Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div><hr /><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> <div class="refsect1 description" id="refsect1-function.date-parse-description"> <h3 class="title">Description</h3> <div class="methodsynopsis dc-description"> <span class="type">array</span> <span class="methodname"><strong>date_parse</strong></span> ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$date</code></span> )</div> </div> <div class="refsect1 parameters" id="refsect1-function.date-parse-parameters"> <h3 class="title">Parameters</h3> <p class="para"> <dl> <dt> <span class="term"><em><code class="parameter">date</code></em></span> <dd> <p class="para"> Date in format accepted by <span class="function"><a href="function.strtotime.html" class="function">strtotime()</a></span>. </p> </dd> </dt> </dl> </p> </div> <div class="refsect1 returnvalues" id="refsect1-function.date-parse-returnvalues"> <h3 class="title">Return Values</h3> <p class="para"> Returns <span class="type"><a href="language.types.array.html" class="type array">array</a></span> with information about the parsed date on success or <strong><code>FALSE</code></strong> on failure. </p> </div> <div class="refsect1 errors" id="refsect1-function.date-parse-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> <div class="refsect1 examples" id="refsect1-function.date-parse-examples"> <h3 class="title">Examples</h3> <p class="para"> <div class="example" id="example-2297"> <p><strong>Example #1 A <span class="function"><strong>date_parse()</strong></span> example</strong></p> <div class="example-contents"> <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"><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> </div> <div class="refsect1 seealso" id="refsect1-function.date-parse-seealso"> <h3 class="title">See Also</h3> <p class="para"> <ul class="simplelist"> <li class="member"> <span class="function"><a href="function.checkdate.html" class="function" rel="rdfs-seeAlso">checkdate()</a> - Validate a Gregorian date</span></li> <li class="member"> <span class="function"><a href="function.getdate.html" class="function" rel="rdfs-seeAlso">getdate()</a> - Get date/time information</span></li> </ul> </p> </div> </div><hr /><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.date-parse-from-format.html">date_parse_from_format</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.date-sub.html">date_sub</a></div> <div class="up"><a href="ref.datetime.html">Date/Time Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div></body></html>