aashcool198 Posted June 3, 2009 Share Posted June 3, 2009 Dates are stored in database in this format 2009/06/03 want that when i retrieve the data to my page the date should look like Wednesday June 03, 2009 please help! Link to comment https://forums.phpfreaks.com/topic/160749-solved-changing-date-format-while-retrieving-from-database/ Share on other sites More sharing options...
JasonLewis Posted June 3, 2009 Share Posted June 3, 2009 You need to use DATE_FORMAT. SELECT DATE_FORMAT(date, '%W %M %d, %Y') as date FROM table WHERE this='that' Link to comment https://forums.phpfreaks.com/topic/160749-solved-changing-date-format-while-retrieving-from-database/#findComment-848369 Share on other sites More sharing options...
cltn77 Posted June 3, 2009 Share Posted June 3, 2009 This will work: echo date('l F d Y',strtotime('2009/06/03')); Link to comment https://forums.phpfreaks.com/topic/160749-solved-changing-date-format-while-retrieving-from-database/#findComment-848371 Share on other sites More sharing options...
JasonLewis Posted June 3, 2009 Share Posted June 3, 2009 This will work: echo date('l F d Y',strtotime('2009/06/03')); However, you may as well do it through MySQL. Link to comment https://forums.phpfreaks.com/topic/160749-solved-changing-date-format-while-retrieving-from-database/#findComment-848373 Share on other sites More sharing options...
aashcool198 Posted June 3, 2009 Author Share Posted June 3, 2009 Thanks to all of you. you are wonderful! Link to comment https://forums.phpfreaks.com/topic/160749-solved-changing-date-format-while-retrieving-from-database/#findComment-848385 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.