<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/ref.datetime.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'zh',
  ),
  'this' => 
  array (
    0 => 'function.strftime.php',
    1 => 'strftime',
    2 => '根据区域设置格式化本地时间/日期',
  ),
  'up' => 
  array (
    0 => 'ref.datetime.php',
    1 => 'Date/Time 函数',
  ),
  'prev' => 
  array (
    0 => 'function.mktime.php',
    1 => 'mktime',
  ),
  'next' => 
  array (
    0 => 'function.strptime.php',
    1 => 'strptime',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'zh',
    'path' => 'reference/datetime/functions/strftime.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.strftime" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">strftime</h1>
  <p class="verinfo">(PHP 4, PHP 5, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">strftime</span> &mdash; <span class="dc-title">根据区域设置格式化本地时间/日期</span></p>

 </div>

 <div id="function.strftime-refsynopsisdiv">
  <div class="warning"><strong class="warning">警告</strong><p class="simpara"> 该函数自 PHP 8.1
起<em>弃用</em>。强烈建议不要依赖此函数。</p>
</div>
<p class="para">
 此函数可以使用如下替代：
</p>

  <ul class="simplelist">
   <li><span class="function"><a href="function.date.php" class="function">date()</a></span></li>
   <li><span class="methodname"><a href="intldateformatter.format.php" class="methodname">IntlDateFormatter::format()</a></span></li>
  </ul>
 </div>

 <div class="refsect1 description" id="refsect1-function.strftime-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="attribute"><a href="class.deprecated.php">#[\Deprecated]</a> </span><br>
   <span class="methodname"><strong>strftime</strong></span>(<span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$format</code></span>, <span class="methodparam"><span class="type"><span class="type"><a href="language.types.null.php" class="type null">?</a></span><span class="type"><a href="language.types.integer.php" class="type int">int</a></span></span> <code class="parameter">$timestamp</code><span class="initializer"> = <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong></span></span>): <span class="type"><span class="type"><a href="language.types.string.php" class="type string">string</a></span>|<span class="type"><a href="language.types.singleton.php" class="type false">false</a></span></span></div>

  <p class="para rdfs-comment">
   返回用给定的格式字串对给出的 <code class="parameter">timestamp</code>
   进行格式输出后的字符串。如果没有给出时间戳则用当前的本地时间。月份和星期几以及其它和语言有关的字符串写法和用
   <span class="function"><a href="function.setlocale.php" class="function">setlocale()</a></span> 设定的当前的区域有关。
  </p>
  <div class="warning"><strong class="warning">警告</strong>
   <p class="para">
    可能不是所有的转换标记都被 C 库文件支持，这种情况下 PHP
    的 <span class="function"><strong>strftime()</strong></span>
    也不支持。此外，不是所有的平台都支持负的时间戳，因此日期的范围可能限定在不早于
    Unix 纪元。这意味着例如
    %e, %T，%R 和 %D（可能更多）以及早于
    <code class="literal">Jan 1, 1970</code> 的时间在 Windows，一些 Linux
    发行版本，以及其它几个操作系统中无效。对于 Windows
    系统，所支持的转换标记可在
    <a href="http://msdn.microsoft.com/en-us/library/fe06s4ak.aspx" class="link external">&raquo;&nbsp;<abbr title="Microsoft Developer Network">MSDN</abbr> 网站</a>找到。
    Instead use the
    <span class="methodname"><a href="intldateformatter.format.php" class="methodname">IntlDateFormatter::format()</a></span> method.
   </p>
  </div>
 </div>

 
 <div class="refsect1 parameters" id="refsect1-function.strftime-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   <dl>
    
     <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><code class="parameter">格式</code></th>
           <th>描述</th>
           <th>返回值示例</th>
          </tr>

         </thead>

         <tbody class="tbody">
          <tr>
           <td style="text-align: center;"><em>日</em></td>
           <td>---</td>
           <td>---</td>
          </tr>

          <tr>
           <td><code class="literal">%a</code></td>
           <td>当前区域星期几的简写</td>
           <td><code class="literal">Sun</code> 到 <code class="literal">Sat</code></td>
          </tr>

          <tr>
           <td><code class="literal">%A</code></td>
           <td>当前区域星期几的全称</td>
           <td><code class="literal">Sunday</code> 到 <code class="literal">Saturday</code></td>
          </tr>

          <tr>
           <td><code class="literal">%d</code></td>
           <td>月份中的第几天，十进制数字（范围从 01 到 31）</td>
           <td><code class="literal">01</code> 到 <code class="literal">31</code></td>
          </tr>

          <tr>
           <td><code class="literal">%e</code></td>
           <td>
            月份中的第几天，十进制数字，一位的数字前会加上一个空格（范围从 &#039; 1&#039; 到 &#039;31&#039;）
            在 Windows 上尚未按描述实现。更多信息见下方。
           </td>
           <td><code class="literal"> 1</code> 到 <code class="literal">31</code></td>
          </tr>

          <tr>
           <td><code class="literal">%j</code></td>
           <td>年份中的第几天，带前导零的三位十进制数（范围从  001 到 366）</td>
           <td><code class="literal">001</code> 到 <code class="literal">366</code></td>
          </tr>

          <tr>
           <td><code class="literal">%u</code></td>
           <td>符合 ISO-8601 星期几的十进制数表达 [1,7]，1 表示星期一</td>
           <td><code class="literal">1</code> (星期一) 到 <code class="literal">7</code> (星期日)</td>
          </tr>

          <tr>
           <td><code class="literal">%w</code></td>
           <td>星期中的第几天，星期天为 0</td>
           <td><code class="literal">0</code> (星期天) 到 <code class="literal">6</code> (星期六)</td>
          </tr>

          <tr>
           <td style="text-align: center;"><em>周</em></td>
           <td>---</td>
           <td>---</td>
          </tr>

          <tr>
           <td><code class="literal">%U</code></td>
           <td>本年的第几周，从第一周的第一个星期天作为第一天开始</td>
           <td><code class="literal">13</code> (for the 13th full week of the year)</td>
          </tr>

          <tr>
           <td><code class="literal">%V</code></td>
           <td>
            %V - 本年第几周的 ISO-8601:1988 格式，范围从 01 到 53，第
            1 周是本年第一个至少还有 4 天的星期，星期一作为每周的第一天。（用
            %G 或者 %g 作为指定时间戳相应周数的年份组成。）
           </td>
           <td><code class="literal">01</code> 到 <code class="literal">53</code> (where 53
            accounts for an overlapping week)</td>
          </tr>

          <tr>
           <td><code class="literal">%W</code></td>
           <td>本年的第几周数，从第一周的第一个星期一作为第一天开始</td>
           <td><code class="literal">46</code> (for the 46th week of the year beginning
            with a Monday)</td>
          </tr>

          <tr>
           <td style="text-align: center;"><em>月</em></td>
           <td>---</td>
           <td>---</td>
          </tr>

          <tr>
           <td><code class="literal">%b</code></td>
           <td>当前区域月份的简写</td>
           <td><code class="literal">Jan</code> 到 <code class="literal">Dec</code></td>
          </tr>

          <tr>
           <td><code class="literal">%B</code></td>
           <td>当前区域月份的全称</td>
           <td><code class="literal">January</code> 到 <code class="literal">December</code></td>
          </tr>

          <tr>
           <td><code class="literal">%h</code></td>
           <td>当前区域月份的简写（%b 的别名）</td>
           <td><code class="literal">Jan</code> 到 <code class="literal">Dec</code></td>
          </tr>

          <tr>
           <td><code class="literal">%m</code></td>
           <td>两位数的月份</td>
           <td><code class="literal">01</code> (是一月份) 到 <code class="literal">12</code> (是十二月份)</td>
          </tr>

          <tr>
           <td style="text-align: center;"><em>年</em></td>
           <td>---</td>
           <td>---</td>
          </tr>

          <tr>
           <td><code class="literal">%C</code></td>
           <td>两位数显示世纪（年份除以 100，截成整数）</td>
           <td><code class="literal">19</code> 是 20 世纪</td>
          </tr>

          <tr>
           <td><code class="literal">%g</code></td>
           <td>
            2 位数的年份，符合 ISO-8601:1988 星期数（参见
            %V）。和 %V 的格式和值一样，只除了如果 ISO 星期数属于前一年或者后一年，则使用那一年。
           </td>
           <td>比如：2009年1月6日那一周是 <code class="literal">09</code>。</td>
          </tr>

          <tr>
           <td><code class="literal">%G</code></td>
           <td>%g 的完整四位数版本</td>
           <td>比如：2009年1月3日那一周是  <code class="literal">2008</code>.</td>
          </tr>

          <tr>
           <td><code class="literal">%y</code></td>
           <td>两位数显示年份</td>
           <td>比如： <code class="literal">09</code> 是 2009，<code class="literal">79</code> 是 1979</td>
          </tr>

          <tr>
           <td><code class="literal">%Y</code></td>
           <td>四位数显示年份</td>
           <td>比如： <code class="literal">2038</code></td>
          </tr>

          <tr>
           <td style="text-align: center;"><em>时间</em></td>
           <td>---</td>
           <td>---</td>
          </tr>

          <tr>
           <td><code class="literal">%H</code></td>
           <td>以 24 小时格式显示两位小时数</td>
           <td><code class="literal">00</code> 到 <code class="literal">23</code></td>
          </tr>

          <tr>
           <td><code class="literal">%k</code></td>
           <td>Hour in 24-hour format, with a space preceding single digits</td>
           <td><code class="literal"> 0</code> through <code class="literal">23</code></td>
          </tr>

          <tr>
           <td><code class="literal">%I</code></td>
           <td>以 12 小时格式显示两位小时数</td>
           <td><code class="literal">01</code> 到 <code class="literal">12</code></td>
          </tr>

          <tr>
           <td><code class="literal">%l（&#039;L&#039; 的小写）</code></td>
           <td>以 12 小时格式显示小时数，单个数字前含空格</td>
           <td><code class="literal"> 1</code> 到 <code class="literal">12</code></td>
          </tr>

          <tr>
           <td><code class="literal">%M</code></td>
           <td>两位的分钟数</td>
           <td><code class="literal">00</code> 到 <code class="literal">59</code></td>
          </tr>

          <tr>
           <td><code class="literal">%p</code></td>
           <td>指定时间的大写 “AM” 或 “PM”</td>
           <td>比如： 00:31 是 <code class="literal">AM</code> ，22:23 
           是<code class="literal">PM</code>。The exact result depends on the
           Operating System, and they can also return lower-case variants, or
           variants with dots (such as <code class="literal">a.m.</code>).</td>
          </tr>

          <tr>
           <td><code class="literal">%P</code></td>
           <td>指定时间的小写 “am” 或 “pm”</td>
           <td>比如：00:31 是 <code class="literal">am</code> ，22:23 
           是<code class="literal">pm</code>。Not supported by all Operating
           Systems.</td>
          </tr>

          <tr>
           <td><code class="literal">%r</code></td>
           <td>和 &quot;%I:%M:%S %p&quot; 一样</td>
           <td>比如： 21:34:17 是 <code class="literal">09:34:17 PM</code></td>
          </tr>

          <tr>
           <td><code class="literal">%R</code></td>
           <td>和 &quot;%H:%M&quot; 一样</td>
           <td>比如： 12:35 AM 是 <code class="literal">00:35</code>，4:44 PM 是 <code class="literal">16:44</code></td>
          </tr>

          <tr>
           <td><code class="literal">%S</code></td>
           <td>两位数字表示秒</td>
           <td><code class="literal">00</code> 到 <code class="literal">59</code></td>
          </tr>

          <tr>
           <td><code class="literal">%T</code></td>
           <td>和 &quot;%H:%M:%S&quot; 一样</td>
           <td>比如： 09:34:17 PM 是 <code class="literal">21:34:17</code></td>
          </tr>

          <tr>
           <td><code class="literal">%X</code></td>
           <td>当前区域首选的时间表示法，不包括日期</td>
           <td>例如： <code class="literal">03:59:16</code> 或 <code class="literal">15:59:16</code></td>
          </tr>

          <tr>
           <td><code class="literal">%z</code></td>
           <td>The time zone offset. Not implemented as described on
           Windows. See below for more information.</td>
           <td>Example: <code class="literal">-0500</code> for US Eastern Time</td>
          </tr>

          <tr>
           <td><code class="literal">%Z</code></td>
           <td>The time zone abbreviation. Not implemented as described on
           Windows. See below for more information.</td>
           <td>Example: <code class="literal">EST</code> for Eastern Time</td>
          </tr>

          <tr>
           <td style="text-align: center;"><em>时间和日期戳</em></td>
           <td>---</td>
           <td>---</td>
          </tr>

          <tr>
           <td><code class="literal">%c</code></td>
           <td>当前区域设置首选的日期时间表达</td>
           <td>比如： 2009 年 2 月 5 日上午 12:45:10 是 <code class="literal">Tue Feb  5 00:45:10 2009</code></td>
          </tr>

          <tr>
           <td><code class="literal">%D</code></td>
           <td>和 &quot;%m/%d/%y&quot; 一样</td>
           <td>比如： 2009 年 2 月 5 日是 <code class="literal">02/05/09</code></td>
          </tr>

          <tr>
           <td><code class="literal">%F</code></td>
           <td>Same as &quot;%Y-%m-%d&quot; (commonly used in database datestamps)</td>
           <td>比如：2009 年 2 月 5 日是 <code class="literal">2009-02-05</code></td>
          </tr>

          <tr>
           <td><code class="literal">%s</code></td>
           <td>Unix纪元的时间戳（和 <span class="function"><a href="function.time.php" class="function">time()</a></span> 函数一样）</td>
           <td>比如： 1979 年 9 月 10 日上午 8 点 40 分 00 秒是 <code class="literal">305815200</code></td>
          </tr>

          <tr>
           <td><code class="literal">%x</code></td>
           <td>当前区域首选的时间表示法，不包括时间</td>
           <td>比如： 2009 年 2 月 5 日是 <code class="literal">02/05/09</code></td>
          </tr>

          <tr>
           <td style="text-align: center;"><em>其他</em></td>
           <td>---</td>
           <td>---</td>
          </tr>

          <tr>
           <td><code class="literal">%n</code></td>
           <td>换行符(&quot;\n&quot;)</td>
           <td>---</td>
          </tr>

          <tr>
           <td><code class="literal">%t</code></td>
           <td>Tab 字符(&quot;\t&quot;)</td>
           <td>---</td>
          </tr>

          <tr>
           <td><code class="literal">%%</code></td>
           <td>文字上的百分字符(&quot;%&quot;)</td>
           <td>---</td>
          </tr>

         </tbody>
        
       </table>

      </p>
      <div class="warning"><strong class="warning">警告</strong>
       <p class="simpara">
        尽管 ISO 9889:1999（当前的 C 标准）明确指出一周从星期一开始，但是
        Sun Solaris 的一周似乎从星期天开始并作为 1。所以 %u 的结果也许不会和手册里描述得一样。
       </p>
      </div>
      <div class="warning"><strong class="warning">警告</strong>
       <p class="para">
        <em>仅针对 Windows：</em>
       </p>
       <p class="para">
        这个函数里 <code class="literal">%e</code> 
        修饰符修饰符还不能支持 Windows。为了得到这个值可以用
        <code class="literal">%#d</code> 修饰符来代替。下例说明了如何写一个跨平台支持的函数。
       </p>
       <p class="para">
        The <code class="literal">%z</code> and <code class="literal">%Z</code> modifiers both
        return the time zone name instead of the offset or abbreviation.
       </p>
      </div>
      <div class="warning"><strong class="warning">警告</strong>
       <p class="simpara">
        <em>仅针对 macOS 和 musl：</em>这个函数里 <code class="literal">%P</code> 修饰符还不能支持 macOS。
       </p>
      </div>
     </dd>
    
    
    <dt><code class="parameter">timestamp</code></dt><dd><p class="para">
可选的 <code class="parameter">timestamp</code> 参数是一个 <span class="type"><a href="language.types.integer.php" class="type int">int</a></span> 的 Unix
时间戳，如未指定或是 <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong>，参数值默认为当前本地时间。也就是说，其值默认为
<span class="function"><a href="function.time.php" class="function">time()</a></span> 的返回值。</p></dd>
    
   </dl>
  </p>
 </div>

 
 <div class="refsect1 returnvalues" id="refsect1-function.strftime-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   根据指定的 <code class="parameter">timestamp</code> 或未给出 timestamp 是使用当前本地时间，
   返回 <code class="parameter">format</code> 格式化的字符。
   月份、星期名和其他与语言相关的字符串遵守 <span class="function"><a href="function.setlocale.php" class="function">setlocale()</a></span> 设置的当前区域设置。
   The function returns <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> if <code class="parameter">format</code> is empty, contains unsupported
   conversion specifiers, or if the length of the returned string would be greater than
   <code class="literal">4095</code>.
  </p>
 </div>

 
 <div class="refsect1 errors" id="refsect1-function.strftime-errors">
  <h3 class="title">错误／异常</h3>
  <p class="para">
在每次调用日期/时间函数时，如果时区无效则会引发 <strong><code><a href="errorfunc.constants.php#constant.e-notice">E_NOTICE</a></code></strong> 错误。参见
<span class="function"><a href="function.date-default-timezone-set.php" class="function">date_default_timezone_set()</a></span>。</p>
  <p class="para">
   由于输出依赖于 C 库，所以一些转换标记并不被支持。
   在 Windows 上，使用未知的转换标记将导致
   5 <strong><code><a href="errorfunc.constants.php#constant.e-warning">E_WARNING</a></code></strong> 信息，并返回 <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong>。
   
   在其他的操作系统上，你可能不能得到任何 <strong><code><a href="errorfunc.constants.php#constant.e-warning">E_WARNING</a></code></strong> 信息，
   并且可能输出未经转换的转换标记。
  </p>
 </div>

 
 <div class="refsect1 changelog" id="refsect1-function.strftime-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>8.0.0</td>
       <td>
        <code class="parameter">timestamp</code> 现在可为 null。
       </td>
      </tr>

     </tbody>
    
   </table>

  </p>
 </div>

 
 <div class="refsect1 examples" id="refsect1-function.strftime-examples">
  <h3 class="title">示例</h3>
  <p class="para">
   如果你的系统里安装了各自的语言环境则下例能够正常运行。
   <div class="example" id="example-1">
    <p><strong>示例 #1 <span class="function"><strong>strftime()</strong></span> 区域示例</strong></p>
<div class="example-contents">
<div class="annotation-non-interactive phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br />setlocale</span><span style="color: #007700">(</span><span style="color: #0000BB">LC_TIME</span><span style="color: #007700">, </span><span style="color: #DD0000">"C"</span><span style="color: #007700">);<br />echo </span><span style="color: #0000BB">strftime</span><span style="color: #007700">(</span><span style="color: #DD0000">"%A"</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">setlocale</span><span style="color: #007700">(</span><span style="color: #0000BB">LC_TIME</span><span style="color: #007700">, </span><span style="color: #DD0000">"fi_FI"</span><span style="color: #007700">);<br />echo </span><span style="color: #0000BB">strftime</span><span style="color: #007700">(</span><span style="color: #DD0000">" in Finnish is %A,"</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">setlocale</span><span style="color: #007700">(</span><span style="color: #0000BB">LC_TIME</span><span style="color: #007700">, </span><span style="color: #DD0000">"fr_FR"</span><span style="color: #007700">);<br />echo </span><span style="color: #0000BB">strftime</span><span style="color: #007700">(</span><span style="color: #DD0000">" in French %A and"</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">setlocale</span><span style="color: #007700">(</span><span style="color: #0000BB">LC_TIME</span><span style="color: #007700">, </span><span style="color: #DD0000">"de_DE"</span><span style="color: #007700">);<br />echo </span><span style="color: #0000BB">strftime</span><span style="color: #007700">(</span><span style="color: #DD0000">" in German %A.\n"</span><span style="color: #007700">);</span></span></code></div>
    </div>

   </div>
  </p>
  <p class="para">
   <div class="example" id="example-2">
    <p><strong>示例 #2 ISO 8601:1988 周数示例</strong></p>
    <div class="example-contents">
<div class="annotation-interactive phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br /></span><span style="color: #FF8000">/*     December 2002 / January 2003<br />ISOWk  M   Tu  W   Thu F   Sa  Su<br />----- ----------------------------<br />51     16  17  18  19  20  21  22<br />52     23  24  25  26  27  28  29<br />1      30  31   1   2   3   4   5<br />2       6   7   8   9  10  11  12<br />3      13  14  15  16  17  18  19   */<br /><br />// 输出： 12/28/2002 - %V,%G,%Y = 52,2002,2002<br /></span><span style="color: #007700">echo </span><span style="color: #DD0000">"12/28/2002 - %V,%G,%Y = " </span><span style="color: #007700">. </span><span style="color: #0000BB">strftime</span><span style="color: #007700">(</span><span style="color: #DD0000">"%V,%G,%Y"</span><span style="color: #007700">, </span><span style="color: #0000BB">strtotime</span><span style="color: #007700">(</span><span style="color: #DD0000">"12/28/2002"</span><span style="color: #007700">)) . </span><span style="color: #DD0000">"\n"</span><span style="color: #007700">;<br /><br /></span><span style="color: #FF8000">// 输出： 12/30/2002 - %V,%G,%Y = 1,2003,2002<br /></span><span style="color: #007700">echo </span><span style="color: #DD0000">"12/30/2002 - %V,%G,%Y = " </span><span style="color: #007700">. </span><span style="color: #0000BB">strftime</span><span style="color: #007700">(</span><span style="color: #DD0000">"%V,%G,%Y"</span><span style="color: #007700">, </span><span style="color: #0000BB">strtotime</span><span style="color: #007700">(</span><span style="color: #DD0000">"12/30/2002"</span><span style="color: #007700">)) . </span><span style="color: #DD0000">"\n"</span><span style="color: #007700">;<br /><br /></span><span style="color: #FF8000">// 输出： 1/3/2003 - %V,%G,%Y = 1,2003,2003<br /></span><span style="color: #007700">echo </span><span style="color: #DD0000">"1/3/2003 - %V,%G,%Y = " </span><span style="color: #007700">. </span><span style="color: #0000BB">strftime</span><span style="color: #007700">(</span><span style="color: #DD0000">"%V,%G,%Y"</span><span style="color: #007700">,</span><span style="color: #0000BB">strtotime</span><span style="color: #007700">(</span><span style="color: #DD0000">"1/3/2003"</span><span style="color: #007700">)) . </span><span style="color: #DD0000">"\n"</span><span style="color: #007700">;<br /><br /></span><span style="color: #FF8000">// 输出： 1/10/2003 - %V,%G,%Y = 2,2003,2003<br /></span><span style="color: #007700">echo </span><span style="color: #DD0000">"1/10/2003 - %V,%G,%Y = " </span><span style="color: #007700">. </span><span style="color: #0000BB">strftime</span><span style="color: #007700">(</span><span style="color: #DD0000">"%V,%G,%Y"</span><span style="color: #007700">,</span><span style="color: #0000BB">strtotime</span><span style="color: #007700">(</span><span style="color: #DD0000">"1/10/2003"</span><span style="color: #007700">)) . </span><span style="color: #DD0000">"\n"</span><span style="color: #007700">;<br /><br /><br /><br /></span><span style="color: #FF8000">/*     December 2004 / January 2005<br />ISOWk  M   Tu  W   Thu F   Sa  Su<br />----- ----------------------------<br />51     13  14  15  16  17  18  19<br />52     20  21  22  23  24  25  26<br />53     27  28  29  30  31   1   2<br />1       3   4   5   6   7   8   9<br />2      10  11  12  13  14  15  16   */<br /><br />// 输出： 12/23/2004 - %V,%G,%Y = 52,2004,2004<br /></span><span style="color: #007700">echo </span><span style="color: #DD0000">"12/23/2004 - %V,%G,%Y = " </span><span style="color: #007700">. </span><span style="color: #0000BB">strftime</span><span style="color: #007700">(</span><span style="color: #DD0000">"%V,%G,%Y"</span><span style="color: #007700">,</span><span style="color: #0000BB">strtotime</span><span style="color: #007700">(</span><span style="color: #DD0000">"12/23/2004"</span><span style="color: #007700">)) . </span><span style="color: #DD0000">"\n"</span><span style="color: #007700">;<br /><br /></span><span style="color: #FF8000">// 输出： 12/31/2004 - %V,%G,%Y = 53,2004,2004<br /></span><span style="color: #007700">echo </span><span style="color: #DD0000">"12/31/2004 - %V,%G,%Y = " </span><span style="color: #007700">. </span><span style="color: #0000BB">strftime</span><span style="color: #007700">(</span><span style="color: #DD0000">"%V,%G,%Y"</span><span style="color: #007700">,</span><span style="color: #0000BB">strtotime</span><span style="color: #007700">(</span><span style="color: #DD0000">"12/31/2004"</span><span style="color: #007700">)) . </span><span style="color: #DD0000">"\n"</span><span style="color: #007700">;<br /><br /></span><span style="color: #FF8000">// 输出： 1/2/2005 - %V,%G,%Y = 53,2004,2005<br /></span><span style="color: #007700">echo </span><span style="color: #DD0000">"1/2/2005 - %V,%G,%Y = " </span><span style="color: #007700">. </span><span style="color: #0000BB">strftime</span><span style="color: #007700">(</span><span style="color: #DD0000">"%V,%G,%Y"</span><span style="color: #007700">,</span><span style="color: #0000BB">strtotime</span><span style="color: #007700">(</span><span style="color: #DD0000">"1/2/2005"</span><span style="color: #007700">)) . </span><span style="color: #DD0000">"\n"</span><span style="color: #007700">;<br /><br /></span><span style="color: #FF8000">// 输出： 1/3/2005 - %V,%G,%Y = 1,2005,2005<br /></span><span style="color: #007700">echo </span><span style="color: #DD0000">"1/3/2005 - %V,%G,%Y = " </span><span style="color: #007700">. </span><span style="color: #0000BB">strftime</span><span style="color: #007700">(</span><span style="color: #DD0000">"%V,%G,%Y"</span><span style="color: #007700">,</span><span style="color: #0000BB">strtotime</span><span style="color: #007700">(</span><span style="color: #DD0000">"1/3/2005"</span><span style="color: #007700">)) . </span><span style="color: #DD0000">"\n"</span><span style="color: #007700">;</span></span></code></div>
    </div>

   </div>
  </p>
  <p class="para">
   <div class="example" id="example-3">
    <p><strong>示例 #3 <code class="literal">%e</code> 修改器跨平台兼容的示例</strong></p>
    <div class="example-contents">
<div class="annotation-interactive phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br /><br /></span><span style="color: #FF8000">// Jan 1: results in: '%e%1%' (%%, e, %%, %e, %%)<br /></span><span style="color: #0000BB">$format </span><span style="color: #007700">= </span><span style="color: #DD0000">'%%e%%%e%%'</span><span style="color: #007700">;<br /><br /></span><span style="color: #FF8000">// Check for Windows to find and replace the %e <br />// modifier correctly<br /></span><span style="color: #007700">if (</span><span style="color: #0000BB">strtoupper</span><span style="color: #007700">(</span><span style="color: #0000BB">substr</span><span style="color: #007700">(</span><span style="color: #0000BB">PHP_OS</span><span style="color: #007700">, </span><span style="color: #0000BB">0</span><span style="color: #007700">, </span><span style="color: #0000BB">3</span><span style="color: #007700">)) == </span><span style="color: #DD0000">'WIN'</span><span style="color: #007700">) {<br />    </span><span style="color: #0000BB">$format </span><span style="color: #007700">= </span><span style="color: #0000BB">preg_replace</span><span style="color: #007700">(</span><span style="color: #DD0000">'#(?&lt;!%)((?:%%)*)%e#'</span><span style="color: #007700">, </span><span style="color: #DD0000">'&lt;/refsect1&gt;%#d'</span><span style="color: #007700">, </span><span style="color: #0000BB">$format</span><span style="color: #007700">);<br />}<br /><br />echo </span><span style="color: #0000BB">strftime</span><span style="color: #007700">(</span><span style="color: #0000BB">$format</span><span style="color: #007700">);</span></span></code></div>
    </div>

   </div>
  </p>
  <p class="para">
   <div class="example" id="example-4">
    <p><strong>示例 #4 显示所有已知和未知的格式</strong></p>
    <div class="example-contents">
<div class="annotation-interactive phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br /><br /></span><span style="color: #FF8000">// Describe the formats<br /></span><span style="color: #0000BB">$strftimeFormats </span><span style="color: #007700">= array(<br />    </span><span style="color: #DD0000">'A' </span><span style="color: #007700">=&gt; </span><span style="color: #DD0000">'A full textual representation of the day'</span><span style="color: #007700">,<br />    </span><span style="color: #DD0000">'B' </span><span style="color: #007700">=&gt; </span><span style="color: #DD0000">'Full month name, based on the locale'</span><span style="color: #007700">,<br />    </span><span style="color: #DD0000">'C' </span><span style="color: #007700">=&gt; </span><span style="color: #DD0000">'Two digit representation of the century (year divided by 100, truncated to an integer)'</span><span style="color: #007700">,<br />    </span><span style="color: #DD0000">'D' </span><span style="color: #007700">=&gt; </span><span style="color: #DD0000">'Same as "%m/%d/%y"'</span><span style="color: #007700">,<br />    </span><span style="color: #DD0000">'E' </span><span style="color: #007700">=&gt; </span><span style="color: #DD0000">''</span><span style="color: #007700">,<br />    </span><span style="color: #DD0000">'F' </span><span style="color: #007700">=&gt; </span><span style="color: #DD0000">'Same as "%Y-%m-%d"'</span><span style="color: #007700">,<br />    </span><span style="color: #DD0000">'G' </span><span style="color: #007700">=&gt; </span><span style="color: #DD0000">'The full four-digit version of %g'</span><span style="color: #007700">,<br />    </span><span style="color: #DD0000">'H' </span><span style="color: #007700">=&gt; </span><span style="color: #DD0000">'Two digit representation of the hour in 24-hour format'</span><span style="color: #007700">,<br />    </span><span style="color: #DD0000">'I' </span><span style="color: #007700">=&gt; </span><span style="color: #DD0000">'Two digit representation of the hour in 12-hour format'</span><span style="color: #007700">,<br />    </span><span style="color: #DD0000">'J' </span><span style="color: #007700">=&gt; </span><span style="color: #DD0000">''</span><span style="color: #007700">,<br />    </span><span style="color: #DD0000">'K' </span><span style="color: #007700">=&gt; </span><span style="color: #DD0000">''</span><span style="color: #007700">,<br />    </span><span style="color: #DD0000">'L' </span><span style="color: #007700">=&gt; </span><span style="color: #DD0000">''</span><span style="color: #007700">,<br />    </span><span style="color: #DD0000">'M' </span><span style="color: #007700">=&gt; </span><span style="color: #DD0000">'Two digit representation of the minute'</span><span style="color: #007700">,<br />    </span><span style="color: #DD0000">'N' </span><span style="color: #007700">=&gt; </span><span style="color: #DD0000">''</span><span style="color: #007700">,<br />    </span><span style="color: #DD0000">'O' </span><span style="color: #007700">=&gt; </span><span style="color: #DD0000">''</span><span style="color: #007700">,<br />    </span><span style="color: #DD0000">'P' </span><span style="color: #007700">=&gt; </span><span style="color: #DD0000">'lower-case "am" or "pm" based on the given time'</span><span style="color: #007700">,<br />    </span><span style="color: #DD0000">'Q' </span><span style="color: #007700">=&gt; </span><span style="color: #DD0000">''</span><span style="color: #007700">,<br />    </span><span style="color: #DD0000">'R' </span><span style="color: #007700">=&gt; </span><span style="color: #DD0000">'Same as "%H:%M"'</span><span style="color: #007700">,<br />    </span><span style="color: #DD0000">'S' </span><span style="color: #007700">=&gt; </span><span style="color: #DD0000">'Two digit representation of the second'</span><span style="color: #007700">,<br />    </span><span style="color: #DD0000">'T' </span><span style="color: #007700">=&gt; </span><span style="color: #DD0000">'Same as "%H:%M:%S"'</span><span style="color: #007700">,<br />    </span><span style="color: #DD0000">'U' </span><span style="color: #007700">=&gt; </span><span style="color: #DD0000">'Week number of the given year, starting with the first Sunday as the first week'</span><span style="color: #007700">,<br />    </span><span style="color: #DD0000">'V' </span><span style="color: #007700">=&gt; </span><span style="color: #DD0000">'ISO-8601:1988 week number of the given year, starting with the first week of the year with at least 4 weekdays, with Monday being the start of the week'</span><span style="color: #007700">,<br />    </span><span style="color: #DD0000">'W' </span><span style="color: #007700">=&gt; </span><span style="color: #DD0000">'A numeric representation of the week of the year, starting with the first Monday as the first week'</span><span style="color: #007700">,<br />    </span><span style="color: #DD0000">'X' </span><span style="color: #007700">=&gt; </span><span style="color: #DD0000">'Preferred time representation based on locale, without the date'</span><span style="color: #007700">,<br />    </span><span style="color: #DD0000">'Y' </span><span style="color: #007700">=&gt; </span><span style="color: #DD0000">'Four digit representation for the year'</span><span style="color: #007700">,<br />    </span><span style="color: #DD0000">'Z' </span><span style="color: #007700">=&gt; </span><span style="color: #DD0000">'The time zone offset/abbreviation option NOT given by %z (depends on operating system)'</span><span style="color: #007700">,<br />    </span><span style="color: #DD0000">'a' </span><span style="color: #007700">=&gt; </span><span style="color: #DD0000">'An abbreviated textual representation of the day'</span><span style="color: #007700">,<br />    </span><span style="color: #DD0000">'b' </span><span style="color: #007700">=&gt; </span><span style="color: #DD0000">'Abbreviated month name, based on the locale'</span><span style="color: #007700">,<br />    </span><span style="color: #DD0000">'c' </span><span style="color: #007700">=&gt; </span><span style="color: #DD0000">'Preferred date and time stamp based on local'</span><span style="color: #007700">,<br />    </span><span style="color: #DD0000">'d' </span><span style="color: #007700">=&gt; </span><span style="color: #DD0000">'Two-digit day of the month (with leading zeros)'</span><span style="color: #007700">,<br />    </span><span style="color: #DD0000">'e' </span><span style="color: #007700">=&gt; </span><span style="color: #DD0000">'Day of the month, with a space preceding single digits'</span><span style="color: #007700">,<br />    </span><span style="color: #DD0000">'f' </span><span style="color: #007700">=&gt; </span><span style="color: #DD0000">''</span><span style="color: #007700">,<br />    </span><span style="color: #DD0000">'g' </span><span style="color: #007700">=&gt; </span><span style="color: #DD0000">'Two digit representation of the year going by ISO-8601:1988 standards (see %V)'</span><span style="color: #007700">,<br />    </span><span style="color: #DD0000">'h' </span><span style="color: #007700">=&gt; </span><span style="color: #DD0000">'Abbreviated month name, based on the locale (an alias of %b)'</span><span style="color: #007700">,<br />    </span><span style="color: #DD0000">'i' </span><span style="color: #007700">=&gt; </span><span style="color: #DD0000">''</span><span style="color: #007700">,<br />    </span><span style="color: #DD0000">'j' </span><span style="color: #007700">=&gt; </span><span style="color: #DD0000">'Day of the year, 3 digits with leading zeros'</span><span style="color: #007700">,<br />    </span><span style="color: #DD0000">'k' </span><span style="color: #007700">=&gt; </span><span style="color: #DD0000">'Hour in 24-hour format, with a space preceding single digits'</span><span style="color: #007700">,<br />    </span><span style="color: #DD0000">'l' </span><span style="color: #007700">=&gt; </span><span style="color: #DD0000">'Hour in 12-hour format, with a space preceding single digits'</span><span style="color: #007700">,<br />    </span><span style="color: #DD0000">'m' </span><span style="color: #007700">=&gt; </span><span style="color: #DD0000">'Two digit representation of the month'</span><span style="color: #007700">,<br />    </span><span style="color: #DD0000">'n' </span><span style="color: #007700">=&gt; </span><span style="color: #DD0000">'A newline character ("\n")'</span><span style="color: #007700">,<br />    </span><span style="color: #DD0000">'o' </span><span style="color: #007700">=&gt; </span><span style="color: #DD0000">''</span><span style="color: #007700">,<br />    </span><span style="color: #DD0000">'p' </span><span style="color: #007700">=&gt; </span><span style="color: #DD0000">'UPPER-CASE "AM" or "PM" based on the given time'</span><span style="color: #007700">,<br />    </span><span style="color: #DD0000">'q' </span><span style="color: #007700">=&gt; </span><span style="color: #DD0000">''</span><span style="color: #007700">,<br />    </span><span style="color: #DD0000">'r' </span><span style="color: #007700">=&gt; </span><span style="color: #DD0000">'Same as "%I:%M:%S %p"'</span><span style="color: #007700">,<br />    </span><span style="color: #DD0000">'s' </span><span style="color: #007700">=&gt; </span><span style="color: #DD0000">'Unix Epoch Time timestamp'</span><span style="color: #007700">,<br />    </span><span style="color: #DD0000">'t' </span><span style="color: #007700">=&gt; </span><span style="color: #DD0000">'A Tab character ("\t")'</span><span style="color: #007700">,<br />    </span><span style="color: #DD0000">'u' </span><span style="color: #007700">=&gt; </span><span style="color: #DD0000">'ISO-8601 numeric representation of the day of the week'</span><span style="color: #007700">,<br />    </span><span style="color: #DD0000">'v' </span><span style="color: #007700">=&gt; </span><span style="color: #DD0000">''</span><span style="color: #007700">,<br />    </span><span style="color: #DD0000">'w' </span><span style="color: #007700">=&gt; </span><span style="color: #DD0000">'Numeric representation of the day of the week'</span><span style="color: #007700">,<br />    </span><span style="color: #DD0000">'x' </span><span style="color: #007700">=&gt; </span><span style="color: #DD0000">'Preferred date representation based on locale, without the time'</span><span style="color: #007700">,<br />    </span><span style="color: #DD0000">'y' </span><span style="color: #007700">=&gt; </span><span style="color: #DD0000">'Two digit representation of the year'</span><span style="color: #007700">,<br />    </span><span style="color: #DD0000">'z' </span><span style="color: #007700">=&gt; </span><span style="color: #DD0000">'Either the time zone offset from UTC or the abbreviation (depends on operating system)'</span><span style="color: #007700">,<br />    </span><span style="color: #DD0000">'%' </span><span style="color: #007700">=&gt; </span><span style="color: #DD0000">'A literal percentage character ("%")'</span><span style="color: #007700">,<br />);<br /><br /></span><span style="color: #FF8000">// Results<br /></span><span style="color: #0000BB">$strftimeValues </span><span style="color: #007700">= array();<br /><br /></span><span style="color: #FF8000">// Evaluate the formats whilst suppressing any errors<br /></span><span style="color: #007700">foreach (</span><span style="color: #0000BB">$strftimeFormats </span><span style="color: #007700">as </span><span style="color: #0000BB">$format </span><span style="color: #007700">=&gt; </span><span style="color: #0000BB">$description</span><span style="color: #007700">) {<br />    if (</span><span style="color: #0000BB">false </span><span style="color: #007700">!== (</span><span style="color: #0000BB">$value </span><span style="color: #007700">= @</span><span style="color: #0000BB">strftime</span><span style="color: #007700">(</span><span style="color: #DD0000">"%</span><span style="color: #007700">{</span><span style="color: #0000BB">$format</span><span style="color: #007700">}</span><span style="color: #DD0000">"</span><span style="color: #007700">))) {<br />        </span><span style="color: #0000BB">$strftimeValues</span><span style="color: #007700">[</span><span style="color: #0000BB">$format</span><span style="color: #007700">] = </span><span style="color: #0000BB">$value</span><span style="color: #007700">;<br />    }<br />}<br /><br /></span><span style="color: #FF8000">// Find the longest value<br /></span><span style="color: #0000BB">$maxValueLength </span><span style="color: #007700">= </span><span style="color: #0000BB">2 </span><span style="color: #007700">+ </span><span style="color: #0000BB">max</span><span style="color: #007700">(</span><span style="color: #0000BB">array_map</span><span style="color: #007700">(</span><span style="color: #DD0000">'strlen'</span><span style="color: #007700">, </span><span style="color: #0000BB">$strftimeValues</span><span style="color: #007700">));<br /><br /></span><span style="color: #FF8000">// Report known formats<br /></span><span style="color: #007700">foreach (</span><span style="color: #0000BB">$strftimeValues </span><span style="color: #007700">as </span><span style="color: #0000BB">$format </span><span style="color: #007700">=&gt; </span><span style="color: #0000BB">$value</span><span style="color: #007700">) {<br />    echo </span><span style="color: #DD0000">"Known format   : '</span><span style="color: #007700">{</span><span style="color: #0000BB">$format</span><span style="color: #007700">}</span><span style="color: #DD0000">' = "</span><span style="color: #007700">, </span><span style="color: #0000BB">str_pad</span><span style="color: #007700">(</span><span style="color: #DD0000">"'</span><span style="color: #007700">{</span><span style="color: #0000BB">$value</span><span style="color: #007700">}</span><span style="color: #DD0000">'"</span><span style="color: #007700">, </span><span style="color: #0000BB">$maxValueLength</span><span style="color: #007700">), </span><span style="color: #DD0000">" ( </span><span style="color: #007700">{</span><span style="color: #0000BB">$strftimeFormats</span><span style="color: #007700">[</span><span style="color: #0000BB">$format</span><span style="color: #007700">]}</span><span style="color: #DD0000"> )\n"</span><span style="color: #007700">;<br />}<br /><br /></span><span style="color: #FF8000">// Report unknown formats<br /></span><span style="color: #007700">foreach (</span><span style="color: #0000BB">array_diff_key</span><span style="color: #007700">(</span><span style="color: #0000BB">$strftimeFormats</span><span style="color: #007700">, </span><span style="color: #0000BB">$strftimeValues</span><span style="color: #007700">) as </span><span style="color: #0000BB">$format </span><span style="color: #007700">=&gt; </span><span style="color: #0000BB">$description</span><span style="color: #007700">) {<br />    echo </span><span style="color: #DD0000">"Unknown format : '</span><span style="color: #007700">{</span><span style="color: #0000BB">$format</span><span style="color: #007700">}</span><span style="color: #DD0000">'   "</span><span style="color: #007700">, </span><span style="color: #0000BB">str_pad</span><span style="color: #007700">(</span><span style="color: #DD0000">' '</span><span style="color: #007700">, </span><span style="color: #0000BB">$maxValueLength</span><span style="color: #007700">), (</span><span style="color: #0000BB">$description </span><span style="color: #007700">? </span><span style="color: #DD0000">" ( </span><span style="color: #007700">{</span><span style="color: #0000BB">$description</span><span style="color: #007700">}</span><span style="color: #DD0000"> )" </span><span style="color: #007700">: </span><span style="color: #DD0000">''</span><span style="color: #007700">), </span><span style="color: #DD0000">"\n"</span><span style="color: #007700">;<br />}</span></span></code></div>
    </div>

    <div class="example-contents"><p>以上示例的输出类似于：</p></div>
    <div class="example-contents screen">
<div class="annotation-interactive examplescode"><pre class="examplescode">Known format   : &#039;A&#039; = &#039;Friday&#039;            ( A full textual representation of the day )
Known format   : &#039;B&#039; = &#039;December&#039;          ( Full month name, based on the locale )
Known format   : &#039;H&#039; = &#039;11&#039;                ( Two digit representation of the hour in 24-hour format )
Known format   : &#039;I&#039; = &#039;11&#039;                ( Two digit representation of the hour in 12-hour format )
Known format   : &#039;M&#039; = &#039;24&#039;                ( Two digit representation of the minute )
Known format   : &#039;S&#039; = &#039;44&#039;                ( Two digit representation of the second )
Known format   : &#039;U&#039; = &#039;48&#039;                ( Week number of the given year, starting with the first Sunday as the first week )
Known format   : &#039;W&#039; = &#039;48&#039;                ( A numeric representation of the week of the year, starting with the first Monday as the first week )
Known format   : &#039;X&#039; = &#039;11:24:44&#039;          ( Preferred time representation based on locale, without the date )
Known format   : &#039;Y&#039; = &#039;2010&#039;              ( Four digit representation for the year )
Known format   : &#039;Z&#039; = &#039;GMT Standard Time&#039; ( The time zone offset/abbreviation option NOT given by %z (depends on operating system) )
Known format   : &#039;a&#039; = &#039;Fri&#039;               ( An abbreviated textual representation of the day )
Known format   : &#039;b&#039; = &#039;Dec&#039;               ( Abbreviated month name, based on the locale )
Known format   : &#039;c&#039; = &#039;12/03/10 11:24:44&#039; ( Preferred date and time stamp based on local )
Known format   : &#039;d&#039; = &#039;03&#039;                ( Two-digit day of the month (with leading zeros) )
Known format   : &#039;j&#039; = &#039;337&#039;               ( Day of the year, 3 digits with leading zeros )
Known format   : &#039;m&#039; = &#039;12&#039;                ( Two digit representation of the month )
Known format   : &#039;p&#039; = &#039;AM&#039;                ( UPPER-CASE &quot;AM&quot; or &quot;PM&quot; based on the given time )
Known format   : &#039;w&#039; = &#039;5&#039;                 ( Numeric representation of the day of the week )
Known format   : &#039;x&#039; = &#039;12/03/10&#039;          ( Preferred date representation based on locale, without the time )
Known format   : &#039;y&#039; = &#039;10&#039;                ( Two digit representation of the year )
Known format   : &#039;z&#039; = &#039;GMT Standard Time&#039; ( Either the time zone offset from UTC or the abbreviation (depends on operating system) )
Known format   : &#039;%&#039; = &#039;%&#039;                 ( A literal percentage character (&quot;%&quot;) )
Unknown format : &#039;C&#039;                       ( Two digit representation of the century (year divided by 100, truncated to an integer) )
Unknown format : &#039;D&#039;                       ( Same as &quot;%m/%d/%y&quot; )
Unknown format : &#039;E&#039;
Unknown format : &#039;F&#039;                       ( Same as &quot;%Y-%m-%d&quot; )
Unknown format : &#039;G&#039;                       ( The full four-digit version of %g )
Unknown format : &#039;J&#039;
Unknown format : &#039;K&#039;
Unknown format : &#039;L&#039;
Unknown format : &#039;N&#039;
Unknown format : &#039;O&#039;
Unknown format : &#039;P&#039;                       ( lower-case &quot;am&quot; or &quot;pm&quot; based on the given time )
Unknown format : &#039;Q&#039;
Unknown format : &#039;R&#039;                       ( Same as &quot;%H:%M&quot; )
Unknown format : &#039;T&#039;                       ( Same as &quot;%H:%M:%S&quot; )
Unknown format : &#039;V&#039;                       ( ISO-8601:1988 week number of the given year, starting with the first week of the year with at least 4 weekdays, with Monday being the start of the week )
Unknown format : &#039;e&#039;                       ( Day of the month, with a space preceding single digits )
Unknown format : &#039;f&#039;
Unknown format : &#039;g&#039;                       ( Two digit representation of the year going by ISO-8601:1988 standards (see %V) )
Unknown format : &#039;h&#039;                       ( Abbreviated month name, based on the locale (an alias of %b) )
Unknown format : &#039;i&#039;
Unknown format : &#039;k&#039;                       ( Hour in 24-hour format, with a space preceding single digits )
Unknown format : &#039;l&#039;                       ( Hour in 12-hour format, with a space preceding single digits )
Unknown format : &#039;n&#039;                       ( A newline character (&quot;\n&quot;) )
Unknown format : &#039;o&#039;
Unknown format : &#039;q&#039;
Unknown format : &#039;r&#039;                       ( Same as &quot;%I:%M:%S %p&quot; )
Unknown format : &#039;s&#039;                       ( Unix Epoch Time timestamp )
Unknown format : &#039;t&#039;                       ( A Tab character (&quot;\t&quot;) )
Unknown format : &#039;u&#039;                       ( ISO-8601 numeric representation of the day of the week )
Unknown format : &#039;v&#039;</pre>
</div>
    </div>
   </div>
  </p>
 </div>

 
 <div class="refsect1 notes" id="refsect1-function.strftime-notes">
  <h3 class="title">注释</h3>
  <blockquote class="note"><p><strong class="note">注意</strong>: 
   <span class="simpara">
    %G 和 %V，如果数字编号系统未能充分理解，基于 ISO 8601:1988
    的星期数可能得出未预期的结果。见上面的 %V 和以下的示例。
   </span>
  </p></blockquote>
 </div>

 
 <div class="refsect1 seealso" id="refsect1-function.strftime-seealso">
  <h3 class="title">参见</h3>
  <p class="para">
   <ul class="simplelist">
    <li><span class="methodname"><a href="intldateformatter.format.php" class="methodname" rel="rdfs-seeAlso">IntlDateFormatter::format()</a> - Format the date/time value as a string</span></li>
    <li><span class="methodname"><a href="datetime.format.php" class="methodname" rel="rdfs-seeAlso">DateTimeInterface::format()</a> - 按照指定格式返回格式化后的日期</span></li>
    <li><a href="http://strftime.net/" class="link external">&raquo;&nbsp;Online strftime() format design tool</a></li>
    <li><span class="function"><a href="function.setlocale.php" class="function" rel="rdfs-seeAlso">setlocale()</a> - 设置区域信息</span></li>
    <li><span class="function"><a href="function.mktime.php" class="function" rel="rdfs-seeAlso">mktime()</a> - 取得一个日期的 Unix 时间戳</span></li>
    <li><span class="function"><a href="function.strptime.php" class="function" rel="rdfs-seeAlso">strptime()</a> - 解析由 strftime 生成的日期／时间</span></li>
    <li><span class="function"><a href="function.gmstrftime.php" class="function" rel="rdfs-seeAlso">gmstrftime()</a> - 根据区域设置格式化 GMT/UTC 时间/日期</span></li>
    <li><a href="http://www.opengroup.org/onlinepubs/007908799/xsh/strftime.html" class="link external">&raquo;&nbsp;Open Group specification of <span class="function"><strong>strftime()</strong></span></a></li>
   </ul>
  </p>
 </div>

</div><?php manual_footer($setup); ?>