<?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 => 'en',
  ),
  'this' => 
  array (
    0 => 'function.gmstrftime.php',
    1 => 'gmstrftime',
    2 => 'Format a GMT/UTC time/date according to locale settings',
  ),
  'up' => 
  array (
    0 => 'ref.datetime.php',
    1 => 'Date/Time Functions',
  ),
  'prev' => 
  array (
    0 => 'function.gmmktime.php',
    1 => 'gmmktime',
  ),
  'next' => 
  array (
    0 => 'function.idate.php',
    1 => 'idate',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    '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">Format a GMT/UTC time/date according to locale settings</span></p>

 </div>

 <div id="function.gmstrftime-refsynopsisdiv">
  <div class="warning"><strong class="warning">Warning</strong><p class="simpara">This function has been
<em>DEPRECATED</em> as of PHP 8.1.0. Relying on this function
is highly discouraged.</p></div>
<p class="para">
 Alternatives to this function include:
</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">Description</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">
   Behaves the same as <span class="function"><a href="function.strftime.php" class="function">strftime()</a></span> except that the
   time returned is Greenwich Mean Time (GMT). For example, when run
   in Eastern Standard Time (GMT -0500), the first line below prints
   &quot;Dec 31 1998 20:00:00&quot;, while the second prints &quot;Jan 01 1999
   01:00:00&quot;.
  </p>
  <div class="warning"><strong class="warning">Warning</strong>
   <p class="para">
    This function depends on operating system locale information, which might
    be inconsistent with each other, or not available at all. 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.gmstrftime-parameters">
  <h3 class="title">Parameters</h3>
  <p class="para">
   <dl>
    
     <dt><code class="parameter">format</code></dt>
     <dd>
      <p class="para">
       See description in <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">
The optional <code class="parameter">timestamp</code> parameter is an
<span class="type"><a href="language.types.integer.php" class="type int">int</a></span> Unix timestamp that defaults to the current
local time if <code class="parameter">timestamp</code> is omitted or <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong>. In other
words, it defaults to the value of <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">Return Values</h3>
  <p class="para">
   Returns a string formatted according to the given format string
   using the given <code class="parameter">timestamp</code> or the current
   local time if no timestamp is given.  Month and weekday names and
   other language dependent strings respect the current locale set
   with <span class="function"><a href="function.setlocale.php" class="function">setlocale()</a></span>.
   On failure, <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> is returned.
  </p>
 </div>


 <div class="refsect1 changelog" id="refsect1-function.gmstrftime-changelog">
  <h3 class="title">Changelog</h3>
  <p class="para">
   <table class="doctable informaltable">
    
     <thead>
      <tr>
       <th>Version</th>
       <th>Description</th>
      </tr>

     </thead>

     <tbody class="tbody">
      <tr>
       <td>8.0.0</td>
       <td>
        <code class="parameter">timestamp</code> is nullable now.
       </td>
      </tr>

     </tbody>
    
   </table>

  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-function.gmstrftime-examples">
  <h3 class="title">Examples</h3>
  <p class="para">
   <div class="example" id="example-1">
    <p><strong>Example #1 <span class="function"><strong>gmstrftime()</strong></span> example</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">See Also</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> - Returns date formatted according to given format</span></li>
    <li><span class="function"><a href="function.strftime.php" class="function" rel="rdfs-seeAlso">strftime()</a> - Format a local time/date according to locale settings</span></li>
   </ul>
  </p>
 </div>

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