<?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.getdate.php',
    1 => 'getdate',
    2 => 'Get date/time information',
  ),
  'up' => 
  array (
    0 => 'ref.datetime.php',
    1 => 'Date/Time Functions',
  ),
  'prev' => 
  array (
    0 => 'function.date-timezone-set.php',
    1 => 'date_timezone_set',
  ),
  'next' => 
  array (
    0 => 'function.gettimeofday.php',
    1 => 'gettimeofday',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/datetime/functions/getdate.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.getdate" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">getdate</h1>
  <p class="verinfo">(PHP 4, PHP 5, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">getdate</span> &mdash; <span class="dc-title">Get date/time information</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-function.getdate-description">
  <h3 class="title">Description</h3>
  <div class="methodsynopsis dc-description"><span class="methodname"><strong>getdate</strong></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"><a href="language.types.array.php" class="type array">array</a></span></div>

  <p class="para rdfs-comment">
   Returns an associative <span class="type"><a href="language.types.array.php" class="type array">array</a></span> containing the date
   information of the <code class="parameter">timestamp</code>, or 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>.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.getdate-parameters">
  <h3 class="title">Parameters</h3>
  <p class="para">
   <dl>
    
    
<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.getdate-returnvalues">
  <h3 class="title">Return Values</h3>
  <p class="para">
   Returns an associative <span class="type"><a href="language.types.array.php" class="type array">array</a></span> of information related to
   the <code class="parameter">timestamp</code>. Elements from the returned 
   associative array are as follows:
  </p>
  <p class="para">
   <table class="doctable table">
    <caption><strong>Key elements of the returned associative array</strong></caption>
    
     <thead>
      <tr>
       <th>Key</th>
       <th>Description</th>
       <th>Example returned values</th>
      </tr>

     </thead>

     <tbody class="tbody">
      <tr>
       <td><code class="literal">&quot;seconds&quot;</code></td>
       <td>Numeric representation of seconds</td>
       <td><code class="literal">0</code> to <code class="literal">59</code></td>
      </tr>

      <tr>
       <td><code class="literal">&quot;minutes&quot;</code></td>
       <td>Numeric representation of minutes</td>
       <td><code class="literal">0</code> to <code class="literal">59</code></td>
      </tr>

      <tr>
       <td><code class="literal">&quot;hours&quot;</code></td>
       <td>Numeric representation of hours</td>
       <td><code class="literal">0</code> to <code class="literal">23</code></td>
      </tr>

      <tr>
       <td><code class="literal">&quot;mday&quot;</code></td>
       <td>Numeric representation of the day of the month</td>
       <td><code class="literal">1</code> to <code class="literal">31</code></td>
      </tr>

      <tr>
       <td><code class="literal">&quot;wday&quot;</code></td>
       <td>Numeric representation of the day of the week</td>
       <td><code class="literal">0</code> (for Sunday) through <code class="literal">6</code> (for Saturday)</td>
      </tr>

      <tr>
       <td><code class="literal">&quot;mon&quot;</code></td>
       <td>Numeric representation of a month</td>
       <td><code class="literal">1</code> through <code class="literal">12</code></td>
      </tr>

      <tr>
       <td><code class="literal">&quot;year&quot;</code></td>
       <td>A full numeric representation of a year, 4 digits</td>
       <td>Examples: <code class="literal">1999</code> or <code class="literal">2003</code></td>
      </tr>

      <tr>
       <td><code class="literal">&quot;yday&quot;</code></td>
       <td>Numeric representation of the day of the year</td>
       <td><code class="literal">0</code> through <code class="literal">365</code></td>
      </tr>

      <tr>
       <td><code class="literal">&quot;weekday&quot;</code></td>
       <td>A full textual representation of the day of the week</td>
       <td><code class="literal">Sunday</code> through <code class="literal">Saturday</code></td>
      </tr>

      <tr>
       <td><code class="literal">&quot;month&quot;</code></td>
       <td>A full textual representation of a month, such as January or March</td>
       <td><code class="literal">January</code> through <code class="literal">December</code></td>
      </tr>

      <tr>
       <td><code class="literal">0</code></td>
       <td>
        Seconds since the Unix Epoch, similar to the values returned by
        <span class="function"><a href="function.time.php" class="function">time()</a></span> and used by <span class="function"><a href="function.date.php" class="function">date()</a></span>.
       </td>
       <td>
        System Dependent, typically <code class="literal">-2147483648</code> through
        <code class="literal">2147483647</code>.
       </td>
      </tr>

     </tbody>
    
   </table>

  </p>
 </div>


 <div class="refsect1 changelog" id="refsect1-function.getdate-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.getdate-examples">
  <h3 class="title">Examples</h3>
  <p class="para">
   <div class="example" id="example-1">
    <p><strong>Example #1 <span class="function"><strong>getdate()</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 />$today </span><span style="color: #007700">= </span><span style="color: #0000BB">getdate</span><span style="color: #007700">();<br /></span><span style="color: #0000BB">print_r</span><span style="color: #007700">(</span><span style="color: #0000BB">$today</span><span style="color: #007700">);</span></span></code></div>
    </div>

    <div class="example-contents"><p>The above example will output
something similar to:</p></div>
    <div class="example-contents screen">
<div class="annotation-interactive examplescode"><pre class="examplescode">Array
(
    [seconds] =&gt; 40
    [minutes] =&gt; 58
    [hours] =&gt; 21
    [mday] =&gt; 17
    [wday] =&gt; 2
    [mon] =&gt; 6
    [year] =&gt; 2003
    [yday] =&gt; 167
    [weekday] =&gt; Tuesday
    [month] =&gt; June
    [0] =&gt; 1055901520
)</pre>
</div>
    </div>
   </div>
  </p>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.getdate-seealso">
  <h3 class="title">See Also</h3>
  <p class="para">
   <ul class="simplelist">
    <li><span class="function"><a href="function.date.php" class="function" rel="rdfs-seeAlso">date()</a> - Format a Unix timestamp</span></li>
    <li><span class="function"><a href="function.idate.php" class="function" rel="rdfs-seeAlso">idate()</a> - Format a local time/date part as integer</span></li>
    <li><span class="function"><a href="function.localtime.php" class="function" rel="rdfs-seeAlso">localtime()</a> - Get the local time</span></li>
    <li><span class="function"><a href="function.time.php" class="function" rel="rdfs-seeAlso">time()</a> - Return current Unix timestamp</span></li>
    <li><span class="function"><a href="function.setlocale.php" class="function" rel="rdfs-seeAlso">setlocale()</a> - Set locale information</span></li>
   </ul>
  </p>
 </div>

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