I have a string similar to "2012-06-14 20:38:24.213-7:00" and want to convert it to a python date time object with the time zone kept intact, how would I do this?
Asked
Active
Viewed 104 times
1 Answers
1
A fixed offset is not enough to find out the timezone name.
Otherwise pytz
and/or dateutil
libraries might help:
>>> from dateutil import parser
>>> parser.parse('2012-06-14 20:38:24.213-7:00')
datetime.datetime(2012, 6, 14, 20, 38, 24, 213000, tzinfo=tzoffset(None, -25200))