mirror of
https://github.com/fofolee/uTools-Manuals.git
synced 2025-06-18 05:26:57 +08:00
231 lines
8.5 KiB
HTML
231 lines
8.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>返回给定的日期与地点的日出时间</title>
|
|
</head>
|
|
<body class="docs"><div id="layout">
|
|
<div id="layout-content"><div id="function.date-sunrise" class="refentry">
|
|
<div class="refnamediv">
|
|
<h1 class="refname">date_sunrise</h1>
|
|
<p class="verinfo">(PHP 5, PHP 7)</p><p class="refpurpose"><span class="refname">date_sunrise</span> — <span class="dc-title">返回给定的日期与地点的日出时间</span></p>
|
|
|
|
</div>
|
|
<div class="refsect1 description" id="refsect1-function.date-sunrise-description">
|
|
<h3 class="title">说明</h3>
|
|
<div class="methodsynopsis dc-description">
|
|
<span class="methodname"><strong>date_sunrise</strong></span>
|
|
( <span class="methodparam"><span class="type">int</span> <code class="parameter">$timestamp</code></span>
|
|
[, <span class="methodparam"><span class="type">int</span> <code class="parameter">$format</code><span class="initializer"> = SUNFUNCS_RET_STRING</span></span>
|
|
[, <span class="methodparam"><span class="type">float</span> <code class="parameter">$latitude</code><span class="initializer"> = ini_get("date.default_latitude")</span></span>
|
|
[, <span class="methodparam"><span class="type">float</span> <code class="parameter">$longitude</code><span class="initializer"> = ini_get("date.default_longitude")</span></span>
|
|
[, <span class="methodparam"><span class="type">float</span> <code class="parameter">$zenith</code><span class="initializer"> = ini_get("date.sunrise_zenith")</span></span>
|
|
[, <span class="methodparam"><span class="type">float</span> <code class="parameter">$gmt_offset</code><span class="initializer"> = 0</span></span>
|
|
]]]]] ) : <span class="type"><a href="language.pseudo-types.html#language.types.mixed" class="type mixed">mixed</a></span></div>
|
|
|
|
<p class="para rdfs-comment">
|
|
<span class="function"><strong>date_sunrise()</strong></span> 返回给定的日期(以
|
|
<code class="parameter">timestamp</code> 指定)与地点的日出时间。
|
|
</p>
|
|
</div>
|
|
|
|
|
|
<div class="refsect1 parameters" id="refsect1-function.date-sunrise-parameters">
|
|
<h3 class="title">参数</h3>
|
|
<p class="para">
|
|
<dl>
|
|
|
|
|
|
<dt>
|
|
<code class="parameter">timestamp</code></dt>
|
|
|
|
<dd>
|
|
|
|
<p class="para">
|
|
取 <code class="parameter">timestamp</code>所在日期的日出时间。
|
|
</p>
|
|
</dd>
|
|
|
|
|
|
|
|
<dt>
|
|
<code class="parameter">format</code></dt>
|
|
|
|
<dd>
|
|
|
|
<p class="para">
|
|
<table class="doctable table">
|
|
<caption><strong><code class="parameter">format</code> 常量</strong></caption>
|
|
|
|
<thead>
|
|
<tr>
|
|
<th>常量</th>
|
|
<th>说明</th>
|
|
<th>取值举例</th>
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody class="tbody">
|
|
<tr>
|
|
<td>SUNFUNCS_RET_STRING</td>
|
|
<td>以 <span class="type"><a href="language.types.string.html" class="type string">string</a></span> 格式返回结果</td>
|
|
<td>16:46</td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td>SUNFUNCS_RET_DOUBLE</td>
|
|
<td>以 <span class="type"><a href="language.types.float.html" class="type float">float</a></span> 格式返回结果</td>
|
|
<td>16.78243132</td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td>SUNFUNCS_RET_TIMESTAMP</td>
|
|
<td>以 <span class="type"><a href="language.types.integer.html" class="type integer">integer</a></span> 格式(时间戳)返回结果</td>
|
|
<td>1095034606</td>
|
|
</tr>
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
</p>
|
|
</dd>
|
|
|
|
|
|
|
|
<dt>
|
|
<code class="parameter">latitude</code></dt>
|
|
|
|
<dd>
|
|
|
|
<p class="para">
|
|
默认是指北纬。因此如果要指定南纬,必须传递一个负值。
|
|
参见 <em>date.default_latitude</em>。
|
|
</p>
|
|
</dd>
|
|
|
|
|
|
|
|
<dt>
|
|
<code class="parameter">longitude</code></dt>
|
|
|
|
<dd>
|
|
|
|
<p class="para">
|
|
默认是指东经。因此如果要指定西经,必须传递一个负值。
|
|
参见 <em>date.default_longitude</em>。
|
|
</p>
|
|
</dd>
|
|
|
|
|
|
|
|
<dt>
|
|
<code class="parameter">zenith</code></dt>
|
|
|
|
<dd>
|
|
|
|
<p class="para">
|
|
默认: <em>date.sunrise_zenith</em>。
|
|
</p>
|
|
</dd>
|
|
|
|
|
|
|
|
<dt>
|
|
<code class="parameter">gmtoffset</code></dt>
|
|
|
|
<dd>
|
|
|
|
<p class="para">
|
|
单位是小时。
|
|
</p>
|
|
</dd>
|
|
|
|
|
|
</dl>
|
|
|
|
</p>
|
|
</div>
|
|
|
|
|
|
<div class="refsect1 returnvalues" id="refsect1-function.date-sunrise-returnvalues">
|
|
<h3 class="title">返回值</h3>
|
|
<p class="para">
|
|
按指定格式 <code class="parameter">format</code> 返回的日出时间, 或者在失败时返回 <strong><code>FALSE</code></strong>。
|
|
</p>
|
|
</div>
|
|
|
|
|
|
<div class="refsect1 errors" id="refsect1-function.date-sunrise-errors">
|
|
<h3 class="title">错误/异常</h3>
|
|
|
|
<p class="para">
|
|
在每 次调用日期/时间函数时,如果时区无效则会引发 <strong><code>E_NOTICE</code></strong> 错误,如果使用系统设定值或 <var class="varname"><var class="varname">TZ</var></var>
|
|
环境变量,则会引发 <strong><code>E_STRICT</code></strong> 或 <strong><code>E_WARNING</code></strong> 消息。参见
|
|
<span class="function"><a href="date_default_timezone_set.html" class="function">date_default_timezone_set()</a></span>。</p>
|
|
|
|
</div>
|
|
|
|
|
|
<div class="refsect1 changelog" id="refsect1-function.date-sunrise-changelog">
|
|
<h3 class="title">更新日志</h3>
|
|
<p class="para">
|
|
<table class="doctable informaltable">
|
|
|
|
<thead>
|
|
<tr>
|
|
<th>版本</th>
|
|
<th>说明</th>
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody class="tbody">
|
|
|
|
<tr><td>5.1.0</td><td><p class="para">
|
|
现在发布 <strong><code>E_STRICT</code></strong> 和 <strong><code>E_NOTICE</code></strong>
|
|
时区错误。</p></td></tr>
|
|
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
</p>
|
|
</div>
|
|
|
|
|
|
<div class="refsect1 examples" id="refsect1-function.date-sunrise-examples">
|
|
<h3 class="title">范例</h3>
|
|
<p class="para">
|
|
<div class="example" id="example-2710">
|
|
<p><strong>Example #1 <span class="function"><strong>date_sunrise()</strong></span> 例子</strong></p>
|
|
<div class="example-contents">
|
|
<div class="phpcode"><pre><span style="color: #000000">
|
|
<span style="color: #0000BB"><?php<br /><br /></span><span style="color: #FF8000">/* 计算葡萄牙里斯本的日出时间<br />Latitude: 北纬 38.4 度<br />Longitude: 西经 9 度<br />Zenith ~= 90<br />offset: +1 GMT<br />*/<br /><br /></span><span style="color: #007700">echo </span><span style="color: #0000BB">date</span><span style="color: #007700">(</span><span style="color: #DD0000">"D M d Y"</span><span style="color: #007700">). </span><span style="color: #DD0000">', sunrise time : ' </span><span style="color: #007700">.</span><span style="color: #0000BB">date_sunrise</span><span style="color: #007700">(</span><span style="color: #0000BB">time</span><span style="color: #007700">(), </span><span style="color: #0000BB">SUNFUNCS_RET_STRING</span><span style="color: #007700">, </span><span style="color: #0000BB">38.4</span><span style="color: #007700">, -</span><span style="color: #0000BB">9</span><span style="color: #007700">, </span><span style="color: #0000BB">90</span><span style="color: #007700">, </span><span style="color: #0000BB">1</span><span style="color: #007700">);<br /><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>
|
|
Mon Dec 20 2004, sunrise time : 08:54
|
|
</pre></div>
|
|
</div>
|
|
</div>
|
|
</p>
|
|
</div>
|
|
|
|
|
|
<div class="refsect1 seealso" id="refsect1-function.date-sunrise-seealso">
|
|
<h3 class="title">参见</h3>
|
|
<p class="para">
|
|
<ul class="simplelist">
|
|
<li class="member"><span class="function"><a href="date_sunset.html" class="function" rel="rdfs-seeAlso">date_sunset()</a> - 返回给定的日期与地点的日落时间</span></li>
|
|
</ul>
|
|
</p>
|
|
</div>
|
|
|
|
</div></div></div></body></html> |