Tunday Posted July 5, 2015 Share Posted July 5, 2015 I currently have the date time in this format: 2015-07-05T09:50:38.0870000Z How can I convert this into 2015-07-05 09:50:38, such that I can import this into mysql database? Quote Link to comment https://forums.phpfreaks.com/topic/297182-mysql-date-time/ Share on other sites More sharing options...
Solution Ch0cu3r Posted July 5, 2015 Solution Share Posted July 5, 2015 You will need to reformat the date before inserting it in your query, example $date = new DateTime('2015-07-05T09:50:38.0870000Z'); $dateFormatted = $date->format('Y-m-d h:i:s'); // reformat to YYYY-MM-DD HH:MM:SS (mysql datetime) format echo $dateFormatted; 1 Quote Link to comment https://forums.phpfreaks.com/topic/297182-mysql-date-time/#findComment-1515598 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.