yandoo Posted July 19, 2009 Share Posted July 19, 2009 Hi there, Im thinking this should be fairly straightforward. Im trying to change the date format from a recordset date that is retrieved from my database. As the date is: <?php echo $query ['date']; ?> I just need to add the correct (d-m-y) formatting. I can do this easily when applying the current date. e.g. <?php echo date('d-m-y'); ?> But how can it be done from a date retrieved form a database? Thanks Link to comment https://forums.phpfreaks.com/topic/166527-convert-y-m-d-to-d-m-y-from-database-retrieved-date/ Share on other sites More sharing options...
PFMaBiSmAd Posted July 19, 2009 Share Posted July 19, 2009 Use the mysql DATE_FORMAT() function directly in your SELECT query to retrieve the date any way you want - http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html#function_date-format Link to comment https://forums.phpfreaks.com/topic/166527-convert-y-m-d-to-d-m-y-from-database-retrieved-date/#findComment-878173 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.