vinpkl Posted June 5, 2015 Share Posted June 5, 2015 Hi i have below format date and time stored in database 2015-06-06 02:13:54 How can i reformat it, so it displays as 06-06-2015 02:13:54 Thanks Vineet Quote Link to comment https://forums.phpfreaks.com/topic/296662-reformat-date-while-displaying/ Share on other sites More sharing options...
Solution Barand Posted June 5, 2015 Solution Share Posted June 5, 2015 (edited) Either use php echo date('d-m-Y H:i:s', strtotime(db_date)); or use the SQL SELECT DATE_FORMAT(db_date, '%d-%m-%Y %H-%i-%s') ... Edited June 5, 2015 by Barand Quote Link to comment https://forums.phpfreaks.com/topic/296662-reformat-date-while-displaying/#findComment-1513266 Share on other sites More sharing options...
vinpkl Posted June 5, 2015 Author Share Posted June 5, 2015 Hi Barand This worked perfect. Thanks Vineet Quote Link to comment https://forums.phpfreaks.com/topic/296662-reformat-date-while-displaying/#findComment-1513267 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.