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? Link to comment https://forums.phpfreaks.com/topic/297182-mysql-date-time/ Share on other sites More sharing options...
Ch0cu3r Posted July 5, 2015 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; Link to comment https://forums.phpfreaks.com/topic/297182-mysql-date-time/#findComment-1515598 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.