[New-bugs-announce] [issue39536] Datetime strftime: %Y exports years < 1000 with 3 digits instead of 4 on Linux

Jairo Vadillo report at bugs.python.org
Mon Feb 3 04:46:56 EST 2020


New submission from Jairo Vadillo <jairo at 21buttons.com>:

This two examples are pretty simple.

On MacOS stftime %Y works as expected, retrieving 4 digits:

Python 3.7.6 (default, Dec 30 2019, 19:38:26)
[Clang 11.0.0 (clang-1100.0.33.16)] on darwin
> datetime.strftime(datetime.now().replace(year=100), "%Y-%m-%d")
'0100-02-03'

But on Linux...:

Python 3.7.6 (default, Jan  3 2020, 23:35:31)
[GCC 8.3.0] on linux
> datetime.strftime(datetime.now().replace(year=100), "%Y-%m-%d")
'100-02-03'


This causes a lot of trouble when storing and then retrieving string dates from any string based storage.

----------
components: Library (Lib)
messages: 361274
nosy: Jairo Vadillo
priority: normal
severity: normal
status: open
title: Datetime strftime: %Y exports years < 1000 with 3 digits instead of 4 on Linux
type: behavior
versions: Python 3.7

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue39536>
_______________________________________


More information about the New-bugs-announce mailing list