⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 function.localtime.html

📁 php的帮助文档,涉及到PHP的案例和基本语法,以及实际应用内容
💻 HTML
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html> <head>  <title>Get the local time</title>  <meta http-equiv="content-type" content="text/html; charset=UTF-8"> </head> <body><div style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.idate.html">idate</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.microtime.html">microtime</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.localtime" class="refentry"> <div class="refnamediv">  <h1 class="refname">localtime</h1>  <p class="verinfo">(PHP 4, PHP 5)</p><p class="refpurpose"><span class="refname">localtime</span> &mdash; <span class="dc-title">Get the local time</span></p> </div> <div class="refsect1 description">  <h3 class="title">Description</h3>  <div class="methodsynopsis dc-description">   <span class="type">array</span> <span class="methodname"><b><b>localtime</b></b></span>    ([ <span class="methodparam"><span class="type">int</span> <tt class="parameter">$timestamp</tt></span>   [, <span class="methodparam"><span class="type">bool</span> <tt class="parameter">$is_associative</tt></span>  ]] )</div>  <p class="para rdfs-comment">   The <b>localtime()</b> function returns an array   identical to that of the structure returned by the C function   call.  </p> </div>  <div class="refsect1 parameters">  <h3 class="title">Parameters</h3>  <p class="para">   <dl>        <dt><span class="term"><i><tt class="parameter">timestamp</tt></i></span><dd><p class="para">The optional <i><tt class="parameter">timestamp</tt></i> parameter is an <a href="language.types.integer.html" class="type integer">integer</a> Unix timestamp that defaults to the currentlocal time if a <i><tt class="parameter">timestamp</tt></i> is not given. In other words, it defaults to the value of <a href="function.time.html" class="function">time()</a>. </p></dd></dt>       <dt>     <span class="term"><i><tt class="parameter">is_associative</tt></i></span>     <dd>      <p class="para">       If set to <b><tt>FALSE</tt></b> or not supplied then the array is returned as a regular,        numerically indexed array.  If the argument is set to <b><tt>TRUE</tt></b> then       <b>localtime()</b> returns an associative array containing       all the different elements of the structure returned by the C       function call to localtime.  The names of the different keys of       the associative array are as follows:      </p>      <p class="para">       <ul class="itemizedlist">        <li class="listitem">         <span class="simpara">          &quot;tm_sec&quot; - seconds         </span>        </li>        <li class="listitem">         <span class="simpara">          &quot;tm_min&quot; - minutes         </span>        </li>        <li class="listitem">         <span class="simpara">          &quot;tm_hour&quot; - hour         </span>        </li>        <li class="listitem">         <span class="simpara">          &quot;tm_mday&quot; - day of the month         </span>         <span class="simpara">          Months are from 0 (Jan) to 11 (Dec) and days of the week are from 0 (Sun) to 6 (Sat).         </span>        </li>        <li class="listitem">         <span class="simpara">          &quot;tm_mon&quot; - month of the year, starting with 0 for January         </span>        </li>        <li class="listitem">         <span class="simpara">          &quot;tm_year&quot; - Years since 1900         </span>        </li>        <li class="listitem">         <span class="simpara">          &quot;tm_wday&quot; - Day of the week         </span>        </li>        <li class="listitem">         <span class="simpara">          &quot;tm_yday&quot; - Day of the year         </span>        </li>        <li class="listitem">         <span class="simpara">          &quot;tm_isdst&quot; - Is daylight savings time in effect         </span>        </li>       </ul>      </p>     </dd>    </dt>   </dl>  </p> </div> <div class="refsect1 errors">  <h3 class="title">Errors/Exceptions</h3>      <p class="para">Every call to a date/time function will generate a <b><tt>E_NOTICE</tt></b> if the time zone is not valid, and/or a <b><tt>E_STRICT</tt></b> messageif using the system settings or the <var class="varname">TZ</var> environmentvariable. See also <a href="function.date-default-timezone-set.html" class="function">date_default_timezone_set()</a></p>  </div> <div class="refsect1 changelog">  <h3 class="title">ChangeLog</h3>  <p class="para">   <table class="informaltable">    <colgroup>     <thead valign="middle">      <tr valign="middle">       <th colspan="1">Version</th>       <th colspan="1">Description</th>      </tr>     </thead>     <tbody valign="middle" class="tbody">            <tr valign="middle"><td colspan="1" rowspan="1" align="left">5.1.0</td><td colspan="1" rowspan="1" align="left"><p class="para">Now issues the <b><tt>E_STRICT</tt></b> and <b><tt>E_NOTICE</tt></b> time zone errors.</p></td></tr>          </tbody>    </colgroup>   </table>  </p> </div> <div class="refsect1 examples">  <h3 class="title">Examples</h3>  <p class="para">   <div class="example">    <p><b>Example #1 <b>localtime()</b> example</b></p>    <div class="example-contents"><div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br />$localtime&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">localtime</span><span style="color: #007700">();<br /></span><span style="color: #0000BB">$localtime_assoc&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">localtime</span><span style="color: #007700">(</span><span style="color: #0000BB">time</span><span style="color: #007700">(),&nbsp;</span><span style="color: #0000BB">true</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">print_r</span><span style="color: #007700">(</span><span style="color: #0000BB">$localtime</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">print_r</span><span style="color: #007700">(</span><span style="color: #0000BB">$localtime_assoc</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>    </div>    <div class="example-contents"><p>The above example will output something similar to:</p></div>    <div class="example-contents"><pre><div class="cdata"><pre>Array(    [0] =&gt; 24    [1] =&gt; 3    [2] =&gt; 19    [3] =&gt; 3    [4] =&gt; 3    [5] =&gt; 105    [6] =&gt; 0    [7] =&gt; 92    [8] =&gt; 1)Array(    [tm_sec] =&gt; 24    [tm_min] =&gt; 3    [tm_hour] =&gt; 19    [tm_mday] =&gt; 3    [tm_mon] =&gt; 3    [tm_year] =&gt; 105    [tm_wday] =&gt; 0    [tm_yday] =&gt; 92    [tm_isdst] =&gt; 1)</pre></div>    </pre></div>   </div>  </p> </div></div><hr /><div style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.idate.html">idate</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.microtime.html">microtime</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>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -