wrathican Posted August 2, 2007 Share Posted August 2, 2007 i know this has been asked a whole bunch of times but i dont seem to understand what to do :/ i have my database and in that db there is a table. one of the columns is a date column, so the format is YYYY-MM-DD all i want is to be able to format the date when i retrive it from the DB say the db value is 2007-08-02 i want my php script to display Tuesday, 2nd August 2007 any help on this? Thanks in advanced Link to comment https://forums.phpfreaks.com/topic/63017-mysql-date-and-php/ Share on other sites More sharing options...
ToonMariner Posted August 2, 2007 Share Posted August 2, 2007 $dbdate = '2007-08-02'; $dbdate = explode('-',$dbdate); echo date('l, jS F Y',mktime(0, 0, 0, $dbdate[1], $dbdate[2], $dbdate[0])); Link to comment https://forums.phpfreaks.com/topic/63017-mysql-date-and-php/#findComment-313833 Share on other sites More sharing options...
clearstatcache Posted August 2, 2007 Share Posted August 2, 2007 you may try ds one also... $db_date = '2007-08-02'; $new_format = date('l, jS F Y', strtotime($db_date)); print "$new_format\n"; Link to comment https://forums.phpfreaks.com/topic/63017-mysql-date-and-php/#findComment-313840 Share on other sites More sharing options...
ToonMariner Posted August 2, 2007 Share Posted August 2, 2007 that was what I was trying to remember! yeah that last method is better... Link to comment https://forums.phpfreaks.com/topic/63017-mysql-date-and-php/#findComment-314372 Share on other sites More sharing options...
wrathican Posted August 3, 2007 Author Share Posted August 3, 2007 hehe. i kinda understood the latter method. thanks for youe help peeps! Link to comment https://forums.phpfreaks.com/topic/63017-mysql-date-and-php/#findComment-314813 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.