This issue tracker has been migrated to GitHub ,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2018年09月12日 03:01 by William Chaseling, last changed 2022年04月11日 14:59 by admin. This issue is now closed.
| Messages (3) | |||
|---|---|---|---|
| msg325114 - (view) | Author: William Chaseling (William Chaseling) | Date: 2018年09月12日 03:01 | |
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. |
|||
| msg325115 - (view) | Author: William Chaseling (William Chaseling) | Date: 2018年09月12日 03:03 | |
It's easy to get around using .replace(' ', ' '), but it's still a bit annoying.
|
|||
| msg325117 - (view) | Author: Martin Panter (martin.panter) * (Python committer) | Date: 2018年09月12日 03:47 | |
I think "ctime" and "asctime" are supposed to wrap or imitate the standard C functions: <https://port70.net/~nsz/c/c11/n1570.html#7.27.3.2>, 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. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:59:05 | admin | set | github: 78823 |
| 2018年09月12日 03:47:50 | martin.panter | set | status: open -> closed superseder: Document time.ctime format nosy: + martin.panter messages: + msg325117 resolution: not a bug stage: resolved |
| 2018年09月12日 03:03:09 | William Chaseling | set | messages: + msg325115 |
| 2018年09月12日 03:01:23 | William Chaseling | create | |