problem with strptime and time zone

Alex Willmer alex at moreati.org.uk
Tue Aug 24 17:16:01 EDT 2010


On Aug 24, 9:45 pm, m_ahlenius <ahleni... at gmail.com> wrote:
>
> whereas this fails:
> myStrA = 'Sun Aug 22 19:03:06 PDT'
> gTimeA = strptime( myStrA, '%a %b %d %H:%M:%S %Z')
> print "gTimeA = ",gTimeA
>
> ValueError: time data 'Sun Aug 22 19:03:06 PDT' does not match format
> '%a %b %d %H:%M:%S %Z'

Support for the %Z directive is based on the values contained in
tzname and whether daylight is true. Because of this, it is platform-
specific except for recognizing UTC and GMT which are always known
(and are considered to be non-daylight savings timezones).

http://docs.python.org/library/time.html

Dateutil has it's own timezone database, so should work reliably
http://labix.org/python-dateutil



More information about the Python-list mailing list