I have a datetime string as a string like:
2011-10-23T08:00:00-07:00
How to treat this string as a datetime object.
I read the following documentation:
date = datetime.strptime(data[4],"%Y-%m-%d%Z")
BUt I get an error
ValueError: time data '2011-10-23T08:00:00-07:00' does not match format '%Y-%m-%d%Z'
which is very clear.
But I'm not sure how to read this format.
Any suggestions. Thanks
Edit: Also, I have to add, all I care about is part of the date
source
share