stftime %z time conversion character

Evan Klitzke evan at yelp.com
Tue Jun 19 17:56:59 EDT 2007


Although it is not present in ANSI C, the GNU version of stftime
supports the conversion character %z, which is a time offset from GMT.
The four digit time offset is required in RFC 2822 dates/times, and is
used by a number of other programs as well. I need to convert times
that use this convention to python time representations, and because
Python does not support the %z time conversion character I cannot
simply use the time.strptime function.

What solutions have people used for this? I'm currently thinking of
creating a dict that maps four digit time offsets to the time zone
name and then use the %Z token on that. Is there another (or better)
way?

-- 
Evan Klitzke <evan at yelp.com>



More information about the Python-list mailing list