[New-bugs-announce] [issue39103] [linux] strftime renders %Y with only 3 characters

Jason R. Coombs report at bugs.python.org
Fri Dec 20 00:32:00 EST 2019

New submission from Jason R. Coombs <jaraco at jaraco.com>:

On Python 3.8, there's a difference between how datetime.datetime.strftime renders %Y for years < 1000 between Linux and other platforms.

# Linux
$ docker run -it python python -c 'import datetime; print(datetime.date(900,1,1).strftime("%Y"))'                       

# macOS
$ python -c 'import datetime; print(datetime.date(900,1,1).strftime("%Y"))'                                             

According to the docs (https://docs.python.org/3/library/datetime.html#strftime-strptime-behavior), one should expect `'0000'` for year zero and so I'd expect `'0900'` for the year 900, so the macOS behavior looks correct to me.

components: Library (Lib)
messages: 358695
nosy: jaraco
priority: normal
severity: normal
status: open
title: [linux] strftime renders %Y with only 3 characters
versions: Python 3.8

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list