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.

classification
Title: strftime returns empty string for -d, -I 3.8.3
Type: behavior Stage: resolved
Components: Versions: Python 3.8
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: PMARINA, eric.smith
Priority: normal Keywords:

Created on 2020-10-19 21:07 by PMARINA, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Messages (2)
msg379018 - (view) Author: Pridhvi Myneni (PMARINA) Date: 2020-10-19 21:07
My system has python from MSYS2 integrated with my windows environment, so I can't test if Windows exhibits the same issue; however, this works perfectly in Ubuntu. The issue is %-d, %-I don't work as expected and instead cause the function call to return an empty string. 

Steps to reproduce:
import datetime
now = datetime.datetime.now()
now.strftime("%-I")
...
msg379022 - (view) Author: Eric V. Smith (eric.smith) * (Python committer) Date: 2020-10-19 21:25
Can you tell us what the expected behavior is?

From the strftime docs: "The full set of format codes supported varies across platforms, because Python calls the platform C library’s strftime() function, and platform variations are common. To see the full set of format codes supported on your platform, consult the strftime(3) documentation."

You're probably just seeing platform-specific behavior.

On cygwin, I get an empty string.
History
Date User Action Args
2022-04-11 14:59:37adminsetgithub: 86257
2022-01-24 00:17:50iritkatrielsetstatus: open -> closed
resolution: not a bug
stage: resolved
2020-10-19 21:25:33eric.smithsetnosy: + eric.smith
messages: + msg379022
2020-10-19 21:07:11PMARINAcreate