Timing it right

Apparently Americans have trouble with times expressed in 24-hour format and keep turning up at the wrong time as a result. Here’s yet another remedy for ludicrously over-complicated solutions to a simple date/time problem:

$time = date("g:i A", strtotime("17:30:00"));

That will give you 5:30 PM. If you want a lower-case am/pm, replace the upper-case A with a lower-case one.

This entry was posted in PHP. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>