[issue39103] [linux] strftime renders %Y with only 3 characters

2019-12-20 Thread Paul Ganssle


Paul Ganssle  added the comment:

This is a duplicate of issue 13305.

Right now we have some shims around `strftime` to improve consistency in some 
situations and for other reasons, but mostly we just call the libc version.

There is an open issue from 2008 (#3173) to ship our own implementation of 
strftime that could smooth out some of these issues and try and make the 
behavior more consistent (though presumably some people have started to rely on 
platform-specific behaviors by now, so it may be a decent amount of work to 
roll it out).

I'm going to close this in favor of 13305, but thanks for reporting it!

--
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> datetime.strftime("%Y") not consistent for years < 1000
type:  -> behavior

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39103] [linux] strftime renders %Y with only 3 characters

2019-12-20 Thread Brett Cannon


Brett Cannon  added the comment:

Due note, though, that there's a difference in the implementation of strftime 
versus strptime, as the former (at least the last time I looked ages ago) uses 
the libc version of the function and thus probably doesn't try to smooth out 
differences like this, while the latter is implemented in Python code in the 
stdlib itself.

--
nosy: +brett.cannon

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39103] [linux] strftime renders %Y with only 3 characters

2019-12-19 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +belopolsky, p-ganssle

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39103] [linux] strftime renders %Y with only 3 characters

2019-12-19 Thread Jason R. Coombs


New submission from Jason R. Coombs :

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"))'   
900

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

0900


According to the docs 
(https://docs.python.org/3/library/datetime.html#strftime-strptime-behavior), 
one should expect `''` 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 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com