<?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 => 'ja',
  ),
  'this' => 
  array (
    0 => 'function.gmstrftime.php',
    1 => 'gmstrftime',
    2 => 'ロケールの設定に基づいて GMT/UTC 時刻/日付をフォーマットする',
  ),
  'up' => 
  array (
    0 => 'ref.datetime.php',
    1 => '日付・時刻 関数',
  ),
  'prev' => 
  array (
    0 => 'function.gmmktime.php',
    1 => 'gmmktime',
  ),
  'next' => 
  array (
    0 => 'function.idate.php',
    1 => 'idate',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'ja',
    'path' => 'reference/datetime/functions/gmstrftime.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.gmstrftime" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">gmstrftime</h1>
  <p class="verinfo">(PHP 4, PHP 5, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">gmstrftime</span> &mdash; <span class="dc-title">
   ロケールの設定に基づいて GMT/UTC 時刻/日付をフォーマットする
  </span></p>

 </div>

 <div id="function.gmstrftime-refsynopsisdiv">
  <div class="warning"><strong class="warning">警告</strong><p class="simpara">この関数は PHP 8.1.0 で
<em>非推奨</em> になります。この関数に頼らないことを強く推奨します。</p></div>
<p class="para">
この関数の代替として、これらが使えます:
</p>

  <ul class="simplelist">
   <li><span class="function"><a href="function.gmdate.php" class="function">gmdate()</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.gmstrftime-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>gmstrftime</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">
   グリニッジ標準時を返すこと以外は、
   <span class="function"><a href="function.strftime.php" class="function">strftime()</a></span> と同じ動作をします。例えば、東部標準時
   (GMT -0500) で実行した場合、以下の最初の行は &quot;Dec 31 1998 20:00:00&quot;
   を出力し、二行目は &quot;Jan 01 1999 01:00:00&quot; を出力します。
  </p>
  <div class="warning"><strong class="warning">警告</strong>
   <p class="para">
    この関数は、オペレーティングシステムのロケールの情報に依存しており、
    情報が一貫していなかったり、全く利用できない可能性があります。
    代わりに、<span class="methodname"><a href="intldateformatter.format.php" class="methodname">IntlDateFormatter::format()</a></span>
    を使いましょう。
   </p>
  </div>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.gmstrftime-parameters">
  <h3 class="title">パラメータ</h3>
  <p class="para">
   <dl>
    
     <dt><code class="parameter">format</code></dt>
     <dd>
      <p class="para">
       <span class="function"><a href="function.strftime.php" class="function">strftime()</a></span> の説明を参照ください。
      </p>
     </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 タイムスタンプです。
<code class="parameter">timestamp</code> が指定されなかったり、<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.gmstrftime-returnvalues">
  <h3 class="title">戻り値</h3>
  <p class="para">
   指定した <code class="parameter">timestamp</code> または timestamp
   が指定されていない場合に現在のローカル時間を用いて、
   指定したフォーマット文字列に基づき文字列をフォーマットして返します。
   月および曜日の名前、およびその他の言語依存の文字列は、
   <span class="function"><a href="function.setlocale.php" class="function">setlocale()</a></span> で設定された現在のロケールを尊重して表示されます。
   失敗時には、<strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> を返します。
  </p>
 </div>


 <div class="refsect1 changelog" id="refsect1-function.gmstrftime-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> は、nullable になりました。
       </td>
      </tr>

     </tbody>
    
   </table>

  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-function.gmstrftime-examples">
  <h3 class="title">例</h3>
  <p class="para">
   <div class="example" id="example-1">
    <p><strong>例1 <span class="function"><strong>gmstrftime()</strong></span> の例</strong></p>
    <div class="example-contents">
<div class="annotation-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">'en_US'</span><span style="color: #007700">);<br />echo </span><span style="color: #0000BB">strftime</span><span style="color: #007700">(</span><span style="color: #DD0000">"%b %d %Y %H:%M:%S"</span><span style="color: #007700">, </span><span style="color: #0000BB">mktime</span><span style="color: #007700">(</span><span style="color: #0000BB">20</span><span style="color: #007700">, </span><span style="color: #0000BB">0</span><span style="color: #007700">, </span><span style="color: #0000BB">0</span><span style="color: #007700">, </span><span style="color: #0000BB">12</span><span style="color: #007700">, </span><span style="color: #0000BB">31</span><span style="color: #007700">, </span><span style="color: #0000BB">98</span><span style="color: #007700">)) . </span><span style="color: #DD0000">"\n"</span><span style="color: #007700">;<br />echo </span><span style="color: #0000BB">gmstrftime</span><span style="color: #007700">(</span><span style="color: #DD0000">"%b %d %Y %H:%M:%S"</span><span style="color: #007700">, </span><span style="color: #0000BB">mktime</span><span style="color: #007700">(</span><span style="color: #0000BB">20</span><span style="color: #007700">, </span><span style="color: #0000BB">0</span><span style="color: #007700">, </span><span style="color: #0000BB">0</span><span style="color: #007700">, </span><span style="color: #0000BB">12</span><span style="color: #007700">, </span><span style="color: #0000BB">31</span><span style="color: #007700">, </span><span style="color: #0000BB">98</span><span style="color: #007700">)) . </span><span style="color: #DD0000">"\n"</span><span style="color: #007700">;</span></span></code></div>
    </div>

   </div>
  </p>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.gmstrftime-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> - 日付/時刻 の値を文字列としてフォーマットする</span></li>
    <li><span class="methodname"><a href="datetime.format.php" class="methodname" rel="rdfs-seeAlso">DateTimeInterface::format()</a> - 指定した書式でフォーマットした日付を返す</span></li>
    <li><span class="function"><a href="function.strftime.php" class="function" rel="rdfs-seeAlso">strftime()</a> - ロケールの設定に基づいてローカルな日付・時間をフォーマットする</span></li>
   </ul>
  </p>
 </div>

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