time.strftime BUG?
Graham Ashton
graham at coms.com
Sun Jul 8 18:31:53 EDT 2001
In article <mailman.994491312.28840.python-list at python.org>, "Roman Suzi"
<rnd at onego.ru> wrote:
> >>> time.strftime("%Z", time.localtime(time.time()))
> 'MSD'
> >>> time.strftime("%z", time.localtime(time.time()))
> '+0000'
> While I believe the later should be:
> '+0400'
I'm a bit confused by this too.
ratchet% python
Python 2.1 (#7, Jun 24 2001, 18:32:35)
[GCC 2.95.2 20000220 (Debian GNU/Linux)] on linux2
Type "copyright", "credits" or "license" for more information.
>>> import time
>>> time.strftime("%z")
'+0100'
>>> time.strftime("%z", time.localtime(time.time()))
'+0000'
What gets me is that (according to the way I read them) the docs say
the two satements above should return the same thing.
strftime(format[, tuple]) -> string
Convert a time tuple to a string according to a format specification.
See the library reference manual for formatting codes. When the time
tuple is not present, current time as returned by localtime() is used.
--
Graham
More information about the Python-list
mailing list