classification
Title: Datetime strftime: %Y exports years < 1000 with 3 digits instead of 4 on Linux
Type: behavior Stage: resolved
Components: Library (Lib) Versions: Python 3.7
process
Status: closed Resolution: duplicate
Dependencies: Superseder: datetime.strftime("%Y") not consistent for years < 1000
View: 13305
Assigned To: Nosy List: Jairo Vadillo, mark.dickinson, pmpp
Priority: normal Keywords:

Created on 2020-02-03 09:46 by Jairo Vadillo, last changed 2020-02-03 11:38 by mark.dickinson. This issue is now closed.

Messages (3)
msg361274 - (view) Author: Jairo Vadillo (Jairo Vadillo) Date: 2020-02-03 09:46
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.
msg361281 - (view) Author: Mark Dickinson (mark.dickinson) * (Python committer) Date: 2020-02-03 11:36
Closing as a duplicate of #13305. Feel free to add to the discussion there if you disagree with the resolution of that issue.
msg361282 - (view) Author: Mark Dickinson (mark.dickinson) * (Python committer) Date: 2020-02-03 11:37
> if you disagree with the resolution of that issue

Sorry, my mistake. That issue is still open.
History
Date User Action Args
2020-02-03 11:38:20mark.dickinsonsetsuperseder: datetime.strftime("%Y") not consistent for years < 1000
2020-02-03 11:37:17mark.dickinsonsetmessages: + msg361282
2020-02-03 11:36:14mark.dickinsonsetstatus: open -> closed

nosy: + mark.dickinson
messages: + msg361281

resolution: duplicate
stage: resolved
2020-02-03 09:52:00pmppsetnosy: + pmpp
2020-02-03 09:46:56Jairo Vadillocreate