Handling of timezone conversions is quite a daunting task. I think dateutil is the easier way to get going, no need to reinvent the wheel.
If you don't mind using an external library you may try pytz
http://pypi.python.org/pypi/pytz/
[\offtopic]
As far as using the time module I believe it suffers the same problem as I believe they share a codebase
]]>datetime.datetime.strptime("Thu, 29 Nov 2012 10:36:34 -0600 (CST)"[:-6], "%a, %d %b %Y %H:%M:%S %z")
>>> from dateutil.parser import parser
>>> p = parser()
>>> p.parse("Thu, 29 Nov 2012 10:36:34 -0600 (CST)")
datetime.datetime(2012, 11, 29, 10, 36, 34, tzinfo=tzoffset('CST', -21600))
Handling of timezone conversions is quite a daunting task. I think dateutil is the easier way to get going, no need to reinvent the wheel.
]]>Thu, 29 Nov 2012 10:36:34 -0600 (CST)
this format should work. Shouldn't it?
"%a, %d %b %Y %H:%M:%S %z (%Z)"
Here is what interactive promt gives me
>>> DateNow = datetime.datetime.strptime("Thu, 29 Nov 2012 10:36:34 -0600 (CST)", "%a, %d %b %Y %H:%M:%S %z (%Z)")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python3.3/_strptime.py", line 500, in _strptime_datetime
tt, fraction = _strptime(data_string, format)
File "/usr/lib/python3.3/_strptime.py", line 337, in _strptime
(data_string, format))
ValueError: time data 'Thu, 29 Nov 2012 10:36:34 -0600 (CST)' does not match format '%a, %d %b %Y %H:%M:%S %z (%Z)'
>>>
What am I missing?
]]>