davidwhiteuk Posted August 4, 2009 Share Posted August 4, 2009 Hello, I have a website I programmed with PHP and MySQL. When I take a record from the database, one of the fields is a timestamp and the date is in the format 2009-08-04 17:08:37 or YYYY-MM-DD HH:MM:SS How do I change this so I can make it appear as 4th August 2009 on the site? thanks Link to comment https://forums.phpfreaks.com/topic/168818-help-with-time-format-needed/ Share on other sites More sharing options...
Maq Posted August 4, 2009 Share Posted August 4, 2009 You can use the MySQL DATE_FORMAT() function. Link to comment https://forums.phpfreaks.com/topic/168818-help-with-time-format-needed/#findComment-890694 Share on other sites More sharing options...
watsmyname Posted August 4, 2009 Share Posted August 4, 2009 Hello, I have a website I programmed with PHP and MySQL. When I take a record from the database, one of the fields is a timestamp and the date is in the format 2009-08-04 17:08:37 or YYYY-MM-DD HH:MM:SS How do I change this so I can make it appear as 4th August 2009 on the site? thanks like this, <?php $date_frm_database="2009-08-04 17:08:37"; $date=date("jS F Y",strtotime($date_frm_database)); echo $date; ?> Link to comment https://forums.phpfreaks.com/topic/168818-help-with-time-format-needed/#findComment-890700 Share on other sites More sharing options...
davidwhiteuk Posted August 4, 2009 Author Share Posted August 4, 2009 Thanks for your help guys Link to comment https://forums.phpfreaks.com/topic/168818-help-with-time-format-needed/#findComment-890746 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.