[issue40236] datetime.datetime.strptime get day error

karl report at bugs.python.org
Tue Jul 28 04:41:12 EDT 2020


karl <karl+pythonbugs at la-grange.net> added the comment:

Same on macOS 10.15.6 (19G73)


Python 3.8.3 (v3.8.3:6f8c8320e9, May 13 2020, 16:29:34) 
[Clang 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import datetime
>>> datetime.datetime.strptime("2024-0-3 00:00:00", "%Y-%W-%w %H:%M:%S")
datetime.datetime(2024, 1, 3, 0, 0)
>>> datetime.datetime.strptime("2024-1-3 00:00:00", "%Y-%W-%w %H:%M:%S")
datetime.datetime(2024, 1, 3, 0, 0)


Also 
https://pubs.opengroup.org/onlinepubs/007908799/xsh/strptime.html

note that iso8601 doesn't have this issue.
%V - ISO 8601 week of the year as a decimal number [01, 53].
https://en.wikipedia.org/wiki/ISO_week_date

----------
nosy: +karlcow

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue40236>
_______________________________________


More information about the Python-bugs-list mailing list