Possible Duplicate:
Parsing Dates and Times from Strings using python
I’m reading a string
"2011-06-11"
How can I cast this to a date object?
thanks
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.
If you know it will be in that format, you can use the
strptimefunction:(and it’s not a cast, you’re actually creating a new date out of the string)
If you don’t know the format of the date, I suggest looking at the dateutil module which provides a powerful date parsing function.