[issue6641] strptime doesn't support %z format ?
report at bugs.python.org
Thu Aug 20 18:39:36 CEST 2009
David House <dmhouse at gmail.com> added the comment:
Yes and no.
Firstly, %z isn't listed as deprecated in the documentation of the time
module's strftime -- although %Z is (note differing case).
Secondly, I still think the bug is invalid, because the documentation of
datetime.datetime.strptime says it behaves like time.strptime, whose
documentation says "only the directives specified in the documentation
[of strftime()] are supported". Since we're in the time module, that
reference to strftime() means time.strftime(), which doesn't list %z as
Finally, there *is* a confusing docs issue, however: the "strftime()
behaviour" section in the datetime module documentation lists %z as a
valid directive, whereas it's not listed in time.strftime. Although
these functions have in theory nothing to do with one another, you would
in practice expect them to support the same directives.
Since in fact the footnote in the documentation of time.strftime() says
%z isn't supported by all ANSI C platforms (despite apparently being
required by the standard), I suggest that %z be removed from the list of
allowed modifiers in the "strftime() behaviour" section in the datetime
Python tracker <report at bugs.python.org>
More information about the Python-bugs-list