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

Created on 2020-10-19 21:07 by PMARINA, last changed 2020-10-19 21:25 by eric.smith.

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
2020-10-19 21:25:33eric.smithsetnosy: + eric.smith
messages: + msg379022
2020-10-19 21:07:11PMARINAcreate