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 Quote 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])); Quote 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"; Quote 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... Quote 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! Quote Link to comment https://forums.phpfreaks.com/topic/63017-mysql-date-and-php/#findComment-314813 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.