mirror of
https://github.com/fofolee/uTools-Manuals.git
synced 2025-06-18 05:26:57 +08:00
163 lines
5.5 KiB
HTML
163 lines
5.5 KiB
HTML
<!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 class="docs"><div id="layout">
|
|
<div id="layout-content"><div id="function.date-parse" class="refentry">
|
|
<div class="refnamediv">
|
|
<h1 class="refname">date_parse</h1>
|
|
<p class="verinfo">(PHP 5 >= 5.2.0, PHP 7)</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">说明</h3>
|
|
<div class="methodsynopsis dc-description">
|
|
<span class="methodname"><strong>date_parse</strong></span>
|
|
( <span class="methodparam"><span class="type">string</span> <code class="parameter">$date</code></span>
|
|
) : <span class="type">array</span></div>
|
|
|
|
</div>
|
|
|
|
|
|
<div class="refsect1 parameters" id="refsect1-function.date-parse-parameters">
|
|
<h3 class="title">参数</h3>
|
|
<p class="para">
|
|
<dl>
|
|
|
|
|
|
<dt>
|
|
<code class="parameter">date</code></dt>
|
|
|
|
<dd>
|
|
|
|
<p class="para">
|
|
Date in format accepted by <span class="function"><a href="strtotime.html" class="function">strtotime()</a></span>.
|
|
</p>
|
|
</dd>
|
|
|
|
|
|
</dl>
|
|
|
|
</p>
|
|
</div>
|
|
|
|
|
|
<div class="refsect1 returnvalues" id="refsect1-function.date-parse-returnvalues">
|
|
<h3 class="title">返回值</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 或者在失败时返回 <strong><code>FALSE</code></strong>.
|
|
</p>
|
|
</div>
|
|
|
|
|
|
<div class="refsect1 errors" id="refsect1-function.date-parse-errors">
|
|
<h3 class="title">错误/异常</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">范例</h3>
|
|
<p class="para">
|
|
<div class="example" id="example-2705">
|
|
<p><strong>Example #1 A <span class="function"><strong>date_parse()</strong></span> example</strong></p>
|
|
<div class="example-contents">
|
|
<div class="phpcode"><pre><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>
|
|
</pre></div>
|
|
</div>
|
|
|
|
<div class="example-contents"><p>以上例程会输出:</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 class="para">
|
|
<a href="datetime.formats.relative.html" class="link">Relative formats</a> do not
|
|
influence the values parsed from absolute formats, but are parsed into the
|
|
"relative" element.
|
|
<div class="example" id="example-2706">
|
|
<p><strong>Example #2 <span class="function"><strong>date_parse()</strong></span> with relative formats</strong></p>
|
|
<div class="example-contents">
|
|
<div class="phpcode"><pre><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 +1 week +1 hour"</span><span style="color: #007700">));<br /></span><span style="color: #0000BB">?></span>
|
|
</span>
|
|
</pre></div>
|
|
</div>
|
|
|
|
<div class="example-contents"><p>以上例程会输出:</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] =>
|
|
[relative] => Array
|
|
(
|
|
[year] => 0
|
|
[month] => 0
|
|
[day] => 7
|
|
[hour] => 1
|
|
[minute] => 0
|
|
[second] => 0
|
|
)
|
|
|
|
)</pre></div>
|
|
</div>
|
|
</div>
|
|
</p>
|
|
</div>
|
|
|
|
|
|
<div class="refsect1 seealso" id="refsect1-function.date-parse-seealso">
|
|
<h3 class="title">参见</h3>
|
|
<p class="para">
|
|
<ul class="simplelist">
|
|
<li class="member"><span class="function"><a href="checkdate.html" class="function" rel="rdfs-seeAlso">checkdate()</a> - 验证一个格里高里日期</span></li>
|
|
<li class="member"><span class="function"><a href="getdate.html" class="function" rel="rdfs-seeAlso">getdate()</a> - 取得日期/时间信息</span></li>
|
|
</ul>
|
|
</p>
|
|
</div>
|
|
|
|
|
|
</div></div></div></body></html> |