mirror of
https://github.com/fofolee/uTools-Manuals.git
synced 2025-06-18 13:57:03 +08:00
157 lines
4.9 KiB
HTML
157 lines
4.9 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>Get info about given date formatted according to the specified format</title>
|
|
</head>
|
|
<body class="docs"><div id="layout">
|
|
<div id="layout-content"><div id="function.date-parse-from-format" class="refentry">
|
|
<div class="refnamediv">
|
|
<h1 class="refname">date_parse_from_format</h1>
|
|
<p class="verinfo">(PHP 5 >= 5.3.0, PHP 7)</p><p class="refpurpose"><span class="refname">date_parse_from_format</span> — <span class="dc-title">Get info about given date formatted according to the specified format</span></p>
|
|
|
|
</div>
|
|
|
|
<div class="refsect1 description" id="refsect1-function.date-parse-from-format-description">
|
|
<h3 class="title">说明</h3>
|
|
<div class="methodsynopsis dc-description">
|
|
<span class="methodname"><strong>date_parse_from_format</strong></span>
|
|
( <span class="methodparam"><span class="type">string</span> <code class="parameter">$format</code></span>
|
|
, <span class="methodparam"><span class="type">string</span> <code class="parameter">$date</code></span>
|
|
) : <span class="type">array</span></div>
|
|
|
|
<p class="para rdfs-comment">
|
|
Returns associative array with detailed info about given date.
|
|
</p>
|
|
</div>
|
|
|
|
|
|
<div class="refsect1 parameters" id="refsect1-function.date-parse-from-format-parameters">
|
|
<h3 class="title">参数</h3>
|
|
<p class="para">
|
|
<dl>
|
|
|
|
|
|
<dt>
|
|
<code class="parameter">format</code></dt>
|
|
|
|
<dd>
|
|
|
|
<p class="para">
|
|
Format accepted by <span class="function"><a href="datetime.createfromformat.html" class="function">DateTime::createFromFormat()</a></span>.
|
|
</p>
|
|
</dd>
|
|
|
|
|
|
|
|
<dt>
|
|
<code class="parameter">date</code></dt>
|
|
|
|
<dd>
|
|
|
|
<p class="para">
|
|
String representing the date.
|
|
</p>
|
|
</dd>
|
|
|
|
|
|
</dl>
|
|
|
|
</p>
|
|
</div>
|
|
|
|
|
|
<div class="refsect1 returnvalues" id="refsect1-function.date-parse-from-format-returnvalues">
|
|
<h3 class="title">返回值</h3>
|
|
|
|
<p class="para">
|
|
Returns associative array with detailed info about given date.
|
|
</p>
|
|
</div>
|
|
|
|
|
|
<div class="refsect1 changelog" id="refsect1-function.date-parse-from-format-changelog">
|
|
<h3 class="title">更新日志</h3>
|
|
<table class="doctable informaltable">
|
|
|
|
<thead>
|
|
<tr>
|
|
<th>版本</th>
|
|
<th>说明</th>
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody class="tbody">
|
|
<tr>
|
|
<td>7.2.0</td>
|
|
<td>
|
|
The <em>zone</em> element of the returned array represents
|
|
seconds instead of minutes now, and its sign is inverted. For instance
|
|
<em>-120</em> is now <em>7200</em>.
|
|
</td>
|
|
</tr>
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
</div>
|
|
|
|
|
|
<div class="refsect1 examples" id="refsect1-function.date-parse-from-format-examples">
|
|
<h3 class="title">范例</h3>
|
|
<p class="para">
|
|
<div class="example" id="example-2704">
|
|
<p><strong>Example #1 <span class="function"><strong>date_parse_from_format()</strong></span> example</strong></p>
|
|
<div class="example-contents">
|
|
<div class="phpcode"><pre><span style="color: #000000">
|
|
<span style="color: #0000BB"><?php<br />$date </span><span style="color: #007700">= </span><span style="color: #DD0000">"6.1.2009 13:00+01:00"</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">print_r</span><span style="color: #007700">(</span><span style="color: #0000BB">date_parse_from_format</span><span style="color: #007700">(</span><span style="color: #DD0000">"j.n.Y H:iP"</span><span style="color: #007700">, </span><span style="color: #0000BB">$date</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] => 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] =>
|
|
)
|
|
</pre></div>
|
|
</div>
|
|
</div>
|
|
</p>
|
|
</div>
|
|
|
|
<div class="refsect1 seealso" id="refsect1-function.date-parse-from-format-seealso">
|
|
<h3 class="title">参见</h3>
|
|
<p class="para">
|
|
<ul class="simplelist">
|
|
<li class="member"><span class="function"><a href="datetime.createfromformat.html" class="function" rel="rdfs-seeAlso">DateTime::createFromFormat()</a> - 根据给定的格式解析日期时间字符串</span></li>
|
|
<li class="member"><span class="function"><a href="checkdate.html" class="function" rel="rdfs-seeAlso">checkdate()</a> - 验证一个格里高里日期</span></li>
|
|
</ul>
|
|
</p>
|
|
</div>
|
|
|
|
</div></div></div></body></html> |