[issue34642] time.ctime() uses %3d instead of %.2d to format.

2018-09-11 Thread Martin Panter


Martin Panter  added the comment:

I think "ctime" and "asctime" are supposed to wrap or imitate the standard C 
functions: , so I think this 
is intended behaviour. But see Issue 13927 about improving the documentation.

For a single-digit day of the month, there is supposed to be two spaces. Using 
"%.2d" would produce "Sep02" or "Sep 02", with a leading zero. On the other 
hand, changing the double space to a single space would produce "Sep 2", 
without a leading zero.

--
nosy: +martin.panter
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed
superseder:  -> Extra spaces in the output of time.ctime

___
Python tracker 

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



[issue34642] time.ctime() uses %3d instead of %.2d to format.

2018-09-11 Thread William Chaseling


William Chaseling  added the comment:

It's easy to get around using .replace('  ', ' '), but it's still a bit 
annoying.

--

___
Python tracker 

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



[issue34642] time.ctime() uses %3d instead of %.2d to format.

2018-09-11 Thread William Chaseling


New submission from William Chaseling :

time.ctime() returns _asctime from a C module.
_asctime returns a PyUnicode_FromFormat() result using "%s %s%3d %.2d:%.2d:%.2d 
%d" as the string formatter.

This works: 'Wed Sep 12 22:30:00 2018'
Except when day <10, because it uses %3d instead of %.2d
'Wed Sep  2 22:30:00 2018'

This seems like it might be intended behavior for some reason, but I don't see 
the reason.

--
components: Library (Lib)
messages: 325114
nosy: William Chaseling
priority: normal
severity: normal
status: open
title: time.ctime() uses %3d instead of %.2d to format.
type: behavior
versions: Python 3.7

___
Python tracker 

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