[issue1777412] datetime.strftime dislikes years before 1900

Alexander Belopolsky report at bugs.python.org
Sat Jan 8 02:09:05 CET 2011


Alexander Belopolsky <belopolsky at users.sourceforge.net> added the comment:

On Fri, Jan 7, 2011 at 7:26 PM, STINNER Victor <report at bugs.python.org> wrote:
..
> Here is a patch removing the arbitrary datetime.strftime() limit on year: it adds an
> option "accept2dyear" to time.strftime() and datetime just sets this option to False.
>

The idea of adding an optional argument to  time.strftime() was
discussed on python-dev, but did not get much traction there:

"""
I wish we didn't have to do that -- isn't it easy enough for the app
to do the 2d -> 4d conversion itself before calling the library
function? The only exception would be when parsing a string -- but
strptime can tell whether a 2d or 4d year is requested by the format
code (%y or %Y).

----------

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


More information about the Python-bugs-list mailing list