[docs] [issue13305] datetime.strftime("%Y") not consistent for years < 1000

Ezio Melotti report at bugs.python.org
Sat Mar 12 01:33:03 EST 2016


Ezio Melotti added the comment:

> About Elena Oat's patch issue13305.diff: I'm not sure that
> strftime("%4Y") works on all platforms

It doesn't, that's what the patch is trying to document.
AFAICT it works on my Linux (but not on yours), it gives '4Y' on Mac, and raises an error on Windows.  This should depend on the libc used by system, so the same OS can give different results depending on which libc it uses, and the only sure thing is that %4Y is not a portable solution.
FWIW the patch LGTM (except a couple minor nits -- zero-pad should be hyphenated and there should be a double space after the dot), but I'm not sure if it's better mentioning platforms at all or just being vague and say that it works on some platforms but not others and leave up to the user figuring out where.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue13305>
_______________________________________


More information about the docs mailing list