strptime() doesn't recognize BST as a valid timezone

Adam Monsen haircut at gmail.com
Fri Sep 16 15:08:13 EDT 2005


Ok, I've figured this out.

>>> import os, time
>>> date = '10 August 2005 at 17:26 BST'
>>> format = '%d %B %Y at %H:%M %Z'
>>> os.environ['TZ'] = 'Europe/London'
>>> time.strptime(date, format)
(2005, 8, 10, 17, 26, 0, 2, 222, 1)

Works (unsuprisingly) as advertised at the bottom of this page:
http://docs.python.org/lib/module-time.html

And now I'm a little closer to understanding why. :)

-- 
Adam Monsen
http://adammonsen.com/




More information about the Python-list mailing list