我有一个类似于“2012-06-14 20:38:24.213-7:00”的字符串,并希望将其转换为时间区保持不变的python日期时间对象,我该怎么做? / p>
答案 0 :(得分:1)
A fixed offset is not enough to find out the timezone name.
>>> 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))