I have a huge list of datetime strings like the following
["Jun 1 2005 1:33PM", "Aug 28 1999 12:00AM"]
How do I convert them into datetime objects?
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.
datetime.strptimeparses an input string in the user-specified format into a timezone-naivedatetimeobject:To obtain a
dateobject using an existingdatetimeobject, convert it using.date():Links:
strptimedocs: Python 2, Python 3strptime/strftimeformat string docs: Python 2, Python 3strftime.org format string cheatsheet
Notes:
strptime= "string parse time"strftime= "string format time"