How do I convert a string to a python datetime object with a relevant timezone?
Question: 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?


Answer: [A fixed offset is not enough to find out the timezone
name.](http://stackoverflow.com/q/1274743/4279)

Otherwise [`pytz`](http://pytz.sourceforge.net/) and/or
[`dateutil`](http://labix.org/python-
dateutil/#head-8d03c6c25ead6f9cab0cde83e6f672b52480ab90) 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))
    

