JSHINER Posted July 6, 2007 Share Posted July 6, 2007 I am working with a database where dates / times are stored as: 2007-07-01 13:00:00 I use: <?php echo date("F j, Y",strtotime($var)); ?> To display the date as: July 1, 2007 How can I get the 13:00:00 to display as "1:00 p.m." ? Quote Link to comment Share on other sites More sharing options...
per1os Posted July 6, 2007 Share Posted July 6, 2007 www.php.net/date It should have h for hours i for minutes s for seconds and there should be an am/pm key too. Look through that table to find the combination you need. Quote Link to comment Share on other sites More sharing options...
JSHINER Posted July 6, 2007 Author Share Posted July 6, 2007 Wow that was easy Thanks! Quote Link to comment Share on other sites More sharing options...
akitchin Posted July 6, 2007 Share Posted July 6, 2007 you can also use MySQL's built-in functions for formatting dates and times. it's probably actually more efficient to do so. have a look in the MySQL manual for functions like DATE_FORMAT(). Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.