Solarpitch Posted January 13, 2007 Share Posted January 13, 2007 Hey guys,when I pull the date and time from the DB it displays as "2007-01-09 20:17:40" and I would like it to display as "9th January 2007, 8:20pm". How can I do this after retrieving it from the database . . or even set this as the format when its actually set in the DB in the first place.Thanks! Quote Link to comment Share on other sites More sharing options...
Barand Posted January 13, 2007 Share Posted January 13, 2007 [code]<?php$dbdate = '2007-01-09 20:17:40';echo date ('jS F Y', strtotime($dbdate));?>[/code] Quote Link to comment Share on other sites More sharing options...
paul2463 Posted January 13, 2007 Share Posted January 13, 2007 or you could format it straight from the database[code]<?php$query = "SELECT DATE_FORMAT(`date`, '%D %M %Y, %h:%i %p') FROM `table`"; //returns the date in the format of "9th January 2007, 8:20pm"?>[/code] Quote Link to comment Share on other sites More sharing options...
fenway Posted January 13, 2007 Share Posted January 13, 2007 I'm with paul2463 on this one... sorry, Barand ;-) Quote Link to comment Share on other sites More sharing options...
Barand Posted January 13, 2007 Share Posted January 13, 2007 Et tu, Fenway? 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.