moldoverb Posted October 2, 2009 Share Posted October 2, 2009 Hi all, trying to reformat a date so that it reads MM DD YYYY as opposed to the default stored format YYYY-MM-DD. The working code I have now is: echo $speaker['date']."</span>\n"; I know the format I want is date(F, j, Y) but not sure how to implement. Link to comment https://forums.phpfreaks.com/topic/176309-formatting-dates-from-database-retreival/ Share on other sites More sharing options...
cags Posted October 2, 2009 Share Posted October 2, 2009 Off the top of my head try... date("F, j, Y", strtotime($speaker['date'])); Link to comment https://forums.phpfreaks.com/topic/176309-formatting-dates-from-database-retreival/#findComment-929212 Share on other sites More sharing options...
moldoverb Posted October 2, 2009 Author Share Posted October 2, 2009 Whoops, initially didn't see that I had two semicolons when I changed it, but it works perfectly, thanks. Link to comment https://forums.phpfreaks.com/topic/176309-formatting-dates-from-database-retreival/#findComment-929216 Share on other sites More sharing options...
manwhoeatsrats Posted October 8, 2009 Share Posted October 8, 2009 <?php $foo = date("F d Y" , strtotime(date("Y d F" , $date_from_db))) ?> Link to comment https://forums.phpfreaks.com/topic/176309-formatting-dates-from-database-retreival/#findComment-933409 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.