<!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>Time Formats</title> </head> <body><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="datetime.formats.html">Supported Date and Time Formats</a></div> <div class="next" style="text-align: right; float: right;"><a href="datetime.formats.date.html">Date 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.time" class="section"> <h2 class="title">Time Formats</h2> <p class="para"> This page describes the different time 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>Formats</th> <th>Examples</th> </tr> </thead> <tbody class="tbody"> <tr> <td><em>frac</em></td> <td>. [0-9]+</td> <td>".21342", ".85"</td> </tr> <tr> <td><em>hh</em></td> <td>"0"?[1-9] | "1"[0-2]</td> <td>"04", "7", "12"</td> </tr> <tr> <td><em>HH</em></td> <td>[01][0-9] | "2"[0-4]</td> <td>"04", "7", "19"</td> </tr> <tr> <td><em>meridian</em></td> <td>[AaPp] .? [Mm] .? [\0\t ]</td> <td>"A.m.", "pM", "am."</td> </tr> <tr> <td><em>MM</em></td> <td>[0-5][0-9]</td> <td>"00", "12", "59"</td> </tr> <tr> <td><em>II</em></td> <td>[0-5][0-9]</td> <td>"00", "12", "59"</td> </tr> <tr> <td><em>space</em></td> <td>[ \t]</td> <td class="empty"> </td> </tr> <tr> <td><em>tz</em></td> <td>"("? [A-Za-z]{1,6} ")"? | [A-Z][a-z]+([_/][A-Z][a-z]+)+</td> <td>"CEST", "Europe/Amsterdam", "America/Indiana/Knox"</td> </tr> <tr> <td><em>tzcorrection</em></td> <td>"GMT"? [+-] <em>hh</em> ":"? <em>MM</em>?</td> <td>"+0400", "GMT-07:00", "-07:00"</td> </tr> </tbody> </table> <table class="doctable table"> <caption><strong>12 Hour Notation</strong></caption> <thead> <tr> <th>Description</th> <th>Format</th> <th>Examples</th> </tr> </thead> <tbody class="tbody"> <tr> <td>Hour only, with meridian</td> <td><em>hh</em> <em>space</em>? <em>meridian</em></td> <td>"4 am", "5PM"</td> </tr> <tr> <td>Hour and minutes, with meridian</td> <td><em>hh</em> [.:] <em>MM</em> <em>space</em>? <em>meridian</em></td> <td>"4:08 am", "7:19P.M."</td> </tr> <tr> <td>Hour, minutes and seconds, with meridian</td> <td><em>hh</em> [.:] <em>MM</em> [.:] <em>II</em> <em>space</em>? <em>meridian</em></td> <td>"4:08:37 am", "7:19:19P.M."</td> </tr> <tr> <td>MS SQL (Hour, minutes, seconds and fraction with meridian), PHP 5.3 and later only</td> <td><em>hh</em> ":" <em>MM</em> ":" <em>II</em> [.:] [0-9]+ <em>meridian</em></td> <td>"4:08:39:12313am"</td> </tr> </tbody> </table> <table class="doctable table"> <caption><strong>24 Hour Notation</strong></caption> <thead> <tr> <th>Description</th> <th>Format</th> <th>Examples</th> </tr> </thead> <tbody class="tbody"> <tr> <td>Hour and minutes</td> <td>'t'? <em>HH</em> [.:] <em>MM</em></td> <td>"04:08", "19.19", "T23:43"</td> </tr> <tr> <td>Hour and minutes, no colon</td> <td>'t'? <em>HH</em> <em>MM</em></td> <td>"0408", "t1919", "T2343"</td> </tr> <tr> <td>Hour, minutes and seconds</td> <td>'t'? <em>HH</em> [.:] <em>MM</em> [.:] <em>II</em></td> <td>"04.08.37", "t19:19:19"</td> </tr> <tr> <td>Hour, minutes and seconds, no colon</td> <td>'t'? <em>HH</em> <em>MM</em> <em>II</em></td> <td>"040837", "T191919"</td> </tr> <tr> <td>Hour, minutes, seconds and timezone</td> <td>'t'? <em>HH</em> [.:] <em>MM</em> [.:] <em>II</em> <em>space</em>? ( <em>tzcorrection</em> | <em>tz</em> )</td> <td>"040837CEST", "T191919-0700"</td> </tr> <tr> <td>Hour, minutes, seconds and fraction</td> <td>'t'? <em>HH</em> [.:] <em>MM</em> [.:] <em>II</em> <em>frac</em></td> <td>"04.08.37.81412", "19:19:19.532453"</td> </tr> <tr> <td>Time zone information</td> <td><em>tz</em> | <em>tzcorrection</em></td> <td>"CEST", "Europe/Amsterdam", "+0430", "GMT-06:00"</td> </tr> </tbody> </table> </div><hr /><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="datetime.formats.html">Supported Date and Time Formats</a></div> <div class="next" style="text-align: right; float: right;"><a href="datetime.formats.date.html">Date 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>