I would like to convert strings to datetime objects to be used in the insert statement for MySQL. The strings are received in the following format :
2010-12-21T22:57:04.000Z
The data type of the MySQL column is DATETIME.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can use the
strptimefunction.For instance, that would give:
[EDIT] Well, I’ve seen this has been treated in another thread with a better answer than mine: How to parse an ISO 8601-formatted date?