datetime.strptime w/ non-UTC and non-local TZs?

A

Artur Ergashev

I was hoping somebody give me some clarity on how datetime.strptime is
supposed to work, I'm thinking this is a bug, but wanted to see if the
community has any ideas before I submit a bug to the python tracker.
For reference I am in the CDT timezone...
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.6/_strptime.py", line 325, in _strptime
(data_string, format))
ValueError: time data 'Sun Jul 24 02:54:11 PDT 2011' does not match
format '%a %b %d %H:%M:%S %Z %Y'

The format is correct, and it can parse UTC (as mentioned in the
documentation), and it can parse CDT (which is my current time zone),
but using another timezone causes it to fail. Trying to parse the
failing timezone on a computer set on that timezone works correctly.
The documentation seems to indicate that parsing non-UTC TZs isn't
guaranteed to work, but in that case the exception is non-clear
(perhaps there's no elegant solution here).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,479
Members
44,899
Latest member
RodneyMcAu

Latest Threads

Top