Datetime behavior on windows and linux

Hi all.

When using datetime.strftime with a bad format string on windows I get ValueError: Invalid format string. But on linux I do not get any error. This happens on 2.7.18, 3.9.3 and 3.12.0 but I suspect it happens on other versions, as well.

Is this a bug or is it intended behavior? I attach a screenshot of python 3.12.0 running on windows and next to it one running on the latest official docker image.

1 Like

strftime is an interface to corresponding C libraries, which may differ by platform. The documentation tries to explain how it’s supposed to work generally and what is portably possible; but things like this do crop up.

1 Like

Thank you! That makes perfect sense now.