Sophie

Sophie

distrib > Mageia > 4 > i586 > by-pkgid > f800694edefe91adea2624f711a41a2d > files > 1299

php-manual-en-5.5.7-1.mga4.noarch.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Date Formats</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="datetime.formats.time.html">Time Formats</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="datetime.formats.compound.html">Compound Formats</a></div>
 <div class="up"><a href="datetime.formats.html">Supported Date and Time Formats</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="datetime.formats.date" class="section">
  <h2 class="title">Date Formats</h2>
  
  <p class="para">
   This page describes the different date formats that the
    <span class="function"><a href="function.strtotime.html" class="function">strtotime()</a></span>, <a href="class.datetime.html" class="classname">DateTime</a> and
    <span class="function"><a href="function.date-create.html" class="function">date_create()</a></span> parser understands.
  </p>

  <table class="doctable table">
   <caption><strong>Used Symbols</strong></caption>
   
    <thead>
     <tr>
      <th>Description</th>
      <th>Format</th>
      <th>Examples</th>
     </tr>

    </thead>

    <tbody class="tbody">
     <tr>
      <td><em>daysuf</em></td>
      <td>&quot;st&quot; | &quot;nd&quot; | &quot;rd&quot; | &quot;th&quot;</td>
      <td class="empty">&nbsp;</td>
     </tr>

     <tr>
      <td><em>dd</em></td>
      <td>([0-2]?[0-9] | &quot;3&quot;[01]) <em>daysuf</em>?</td>
      <td>&quot;7th&quot;, &quot;22nd&quot;, &quot;31&quot;</td>
     </tr>

     <tr>
      <td><em>DD</em></td>
      <td>&quot;0&quot; [0-9] | [1-2][0-9] | &quot;3&quot; [01]</td>
      <td>&quot;07&quot;, &quot;31&quot;</td>
     </tr>

     <tr>
      <td><em>m</em></td>
      <td>&#039;january&#039; | &#039;february&#039; | &#039;march&#039; | &#039;april&#039; | &#039;may&#039; | &#039;june&#039; |
      &#039;july&#039; | &#039;august&#039; | &#039;september&#039; | &#039;october&#039; | &#039;november&#039; | &#039;december&#039; |
      &#039;jan&#039; | &#039;feb&#039; | &#039;mar&#039; | &#039;apr&#039; | &#039;may&#039; | &#039;jun&#039; | &#039;jul&#039; | &#039;aug&#039; | &#039;sep&#039; |
      &#039;sept&#039; | &#039;oct&#039; | &#039;nov&#039; | &#039;dec&#039; | &quot;I&quot; | &quot;II&quot; | &quot;III&quot; | &quot;IV&quot; | &quot;V&quot; | &quot;VI&quot;
      | &quot;VII&quot; | &quot;VIII&quot; | &quot;IX&quot; | &quot;X&quot; | &quot;XI&quot; | &quot;XII&quot;</td>
      <td class="empty">&nbsp;</td>
     </tr>

     <tr>
      <td><em>M</em></td>
      <td>&#039;jan&#039; | &#039;feb&#039; | &#039;mar&#039; | &#039;apr&#039; | &#039;may&#039; | &#039;jun&#039; | &#039;jul&#039; | &#039;aug&#039; |
      &#039;sep&#039; | &#039;sept&#039; | &#039;oct&#039; | &#039;nov&#039; | &#039;dec&#039;</td>
      <td class="empty">&nbsp;</td>
     </tr>

     <tr>
      <td><em>mm</em></td>
      <td>&quot;0&quot;? [0-9] | &quot;1&quot;[0-2]</td>
      <td>&quot;0&quot;, &quot;04&quot;, &quot;7&quot;, &quot;12&quot;</td>
     </tr>

     <tr>
      <td><em>MM</em></td>
      <td>&quot;0&quot; [0-9] | &quot;1&quot;[0-2]</td>
      <td>&quot;00&quot;, &quot;04&quot;, &quot;07&quot;, &quot;12&quot;</td>
     </tr>

     <tr>
      <td><em>y</em></td>
      <td>[0-9]{1,4}</td>
      <td>&quot;00&quot;, &quot;78&quot;, &quot;08&quot;, &quot;8&quot;, &quot;2008&quot;</td>
     </tr>

     <tr>
      <td><em>yy</em></td>
      <td>[0-9]{2}</td>
      <td>&quot;00&quot;, &quot;08&quot;, &quot;78&quot;</td>
     </tr>

     <tr>
      <td><em>YY</em></td>
      <td>[0-9]{4}</td>
      <td>&quot;2000&quot;, &quot;2008&quot;, &quot;1978&quot;</td>
     </tr>

    </tbody>
   
  </table>


  <table class="doctable table">
   <caption><strong>Localized Notations</strong></caption>
   
    <thead>
     <tr>
      <th>Description</th>
      <th>Format</th>
      <th>Examples</th>
     </tr>

    </thead>

    <tbody class="tbody">
     <tr>
      <td>American month and day</td>
      <td><em>mm</em> &quot;/&quot; <em>dd</em></td>
      <td>&quot;5/12&quot;, &quot;10/27&quot;</td>
     </tr>

     <tr>
      <td>American month, day and year</td>
      <td><em>mm</em> &quot;/&quot; <em>dd</em> &quot;/&quot; <em>y</em></td>
      <td>&quot;12/22/78&quot;, &quot;1/17/2006&quot;, &quot;1/17/6&quot;</td>
     </tr>

     <tr>
      <td>Four digit year, month and day with slashes</td>
      <td><em>YY</em> &quot;/&quot; <em>mm</em> &quot;/&quot; <em>dd</em></td>
      <td>&quot;2008/6/30&quot;, &quot;1978/12/22&quot;</td>
     </tr>

     <tr>
      <td>Four digit year and month (GNU)</td>
      <td><em>YY</em> &quot;-&quot; <em>mm</em></td>
      <td>&quot;2008-6&quot;, &quot;2008-06&quot;, &quot;1978-12&quot;</td>
     </tr>

     <tr>
      <td>Year, month and day with dashes</td>
      <td><em>y</em> &quot;-&quot; <em>mm</em> &quot;-&quot; <em>dd</em></td>
      <td>&quot;2008-6-30&quot;, &quot;78-12-22&quot;, &quot;8-6-21&quot;</td>
     </tr>

     <tr>
      <td>Day, month and four digit year, with dots, tabs or dashes</td>
      <td><em>dd</em> [.\t-] <em>mm</em> [.-] <em>YY</em></td>
      <td>&quot;30-6-2008&quot;, &quot;22.12\t1978&quot;</td>
     </tr>

     <tr>
      <td>Day, month and two digit year, with dots or tabs</td>
      <td><em>dd</em> [.\t] <em>mm</em> &quot;.&quot; <em>yy</em></td>
      <td>&quot;30.6.08&quot;, &quot;22\t12\t78&quot;</td>
     </tr>

     <tr>
      <td>Day, textual month and year</td>
      <td><em>dd</em> ([ \t.-])* <em>m</em> ([ \t.-])* <em>y</em></td>
      <td>&quot;30-June 2008&quot;, &quot;22DEC78&quot;, &quot;14 III 1879&quot;</td>
     </tr>

     <tr>
      <td>Textual month and four digit year (Day reset to 1)</td>
      <td><em>m</em> ([ \t.-])* <em>YY</em></td>
      <td>&quot;June 2008&quot;, &quot;DEC1978&quot;, &quot;March 1879&quot;</td>
     </tr>

     <tr>
      <td>Four digit year and textual month (Day reset to 1)</td>
      <td><em>YY</em> ([ \t.-])* <em>m</em></td>
      <td>&quot;2008 June&quot;, &quot;1978-XII&quot;, &quot;1879.MArCH&quot;</td>
     </tr>

     <tr>
      <td>Textual month, day and year</td>
      <td><em>m</em> ([ .\t-])* <em>dd</em> [,.stndrh\t ]+ <em>y</em></td>
      <td>&quot;July 1st, 2008&quot;, &quot;April 17, 1790&quot;, &quot;May.9,78&quot;</td>
     </tr>

     <tr>
      <td>Textual month and day</td>
      <td><em>m</em> ([ .\t-])* <em>dd</em> [,.stndrh\t ]*</td>
      <td>&quot;July 1st,&quot;, &quot;Apr 17&quot;, &quot;May.9&quot;</td>
     </tr>

     <tr>
      <td>Day and textual month</td>
      <td><em>d</em> ([ .\t-])* <em>m</em></td>
      <td>&quot;1 July&quot;, &quot;17 Apr&quot;, &quot;9.May&quot;</td>
     </tr>

     <tr>
      <td>Month abbreviation, day and year</td>
      <td><em>M</em> &quot;-&quot; <em>DD</em> &quot;-&quot; <em>y</em></td>
      <td>&quot;May-09-78&quot;, &quot;Apr-17-1790&quot;</td>
     </tr>

     <tr>
      <td>Year, month abbreviation and day</td>
      <td><em>y</em> &quot;-&quot; <em>M</em> &quot;-&quot; <em>DD</em></td>
      <td>&quot;78-Dec-22&quot;, &quot;1814-MAY-17&quot;</td>
     </tr>

     <tr>
      <td>Year (and just the year)</td>
      <td><em>YY</em></td>
      <td>&quot;1978&quot;, &quot;2008&quot;</td>
     </tr>

     <tr>
      <td>Textual month (and just the month)</td>
      <td><em>m</em></td>
      <td>&quot;March&quot;, &quot;jun&quot;, &quot;DEC&quot;</td>
     </tr>

    </tbody>
   
  </table>

  
  <table class="doctable table">
   <caption><strong>ISO8601 Notations</strong></caption>
   
    <thead>
     <tr>
      <th>Description</th>
      <th>Format</th>
      <th>Examples</th>
     </tr>

    </thead>

    <tbody class="tbody">
     <tr>
      <td>Eight digit year, month and day</td>
      <td><em>YY</em> <em>MM</em> <em>DD</em></td>
      <td>&quot;15810726&quot;, &quot;19780417&quot;, &quot;18140517&quot;</td>
     </tr>

     <tr>
      <td>Four digit year, month and day with slashes</td>
      <td><em>YY</em> &quot;/&quot; <em>MM</em> &quot;/&quot; <em>DD</em></td>
      <td>&quot;2008/06/30&quot;, &quot;1978/12/22&quot;</td>
     </tr>

     <tr>
      <td>Two digit year, month and day with dashes</td>
      <td><em>yy</em> &quot;-&quot; <em>MM</em> &quot;-&quot; <em>DD</em></td>
      <td>&quot;08-06-30&quot;, &quot;78-12-22&quot;</td>
     </tr>

     <tr>
      <td>Four digit year with optional sign, month and day</td>
      <td>[+-]? <em>YY</em> &quot;-&quot; <em>MM</em> &quot;-&quot; <em>DD</em></td>
      <td>&quot;-0002-07-26&quot;, &quot;+1978-04-17&quot;, &quot;1814-05-17&quot;</td>
     </tr>

    </tbody>
   
  </table>


  <blockquote class="note"><p><strong class="note">Note</strong>: 
   <p class="para">
    For the <em>y</em> and <em>yy</em>
    formats, years below 100 are handled in a special way when the
    <em>y</em> or <em>yy</em> symbol is used.
    If the year falls in the range 0 (inclusive) to 69 (inclusive),
    2000 is added. If the year falls in the range 70 (inclusive) to
    99 (inclusive) then 1900 is added. This means that &quot;00-01-01&quot; is
    interpreted as &quot;2000-01-01&quot;.
   </p>
  </p></blockquote>

  <blockquote class="note"><p><strong class="note">Note</strong>: 
   <p class="para">
    The &quot;Day, month and two digit year, with dots or tabs&quot; format
    (<em>dd</em> [.\t] <em>mm</em> &quot;.&quot;
    <em>yy</em>) only works for the year values 61 (inclusive)
    to 99 (inclusive) - outside those years the <em class="emphasis">time
    format</em> &quot;<em>HH</em> [.:] <em>MM</em>
    [.:] <em>SS</em>&quot; has precedence.
   </p>
  </p></blockquote>

  <blockquote class="note"><p><strong class="note">Note</strong>: 
   <p class="para">
    The &quot;Year (and just the year)&quot; format only works if a time string
    has already been found -- otherwise this format is recognised as
    <em>HH</em> <em>MM</em>.
   </p>
  </p></blockquote>

  <blockquote class="note"><p><strong class="note">Note</strong>: 
   <p class="para">
    It is possible to over- and underflow the <em>dd</em> and
    <em>DD</em> format. Day 0 means the last day of previous
    month, whereas overflows count into the next month. This makes
    &quot;2008-08-00&quot; equivalent to &quot;2008-07-31&quot; and &quot;2008-06-31&quot; equivalent
    to &quot;2008-07-01&quot; (June only has 30 days).
   </p>
   <p class="para">
    It is also possible to underflow the <em>mm</em> and
    <em>MM</em> formats with the value 0. A month value of
    0 means December of the previous year. As example &quot;2008-00-22&quot; is
    equivalent to &quot;2007-12-22&quot;.
   </p>
   <p class="para">
    If you combine the previous two facts and underflow both the day and
    the month, the following happens: &quot;2008-00-00&quot; first gets converted
    to &quot;2007-12-00&quot; which then gets converted to &quot;2007-11-30&quot;. This also
    happens with the string &quot;0000-00-00&quot;, which gets transformed into
    &quot;-0001-11-30&quot; (the year -1 in the ISO 8601 calendar, which is 2 BC
    in the proleptic Gregorian calendar).
   </p>
  </p></blockquote>
 </div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="datetime.formats.time.html">Time Formats</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="datetime.formats.compound.html">Compound Formats</a></div>
 <div class="up"><a href="datetime.formats.html">Supported Date and Time Formats</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>