Sergey Bon. <[email protected]> added the comment:
Documentation says:
%U - Week number of the year (Sunday as the first day of the week)
%W - Week number of the year (Monday as the first day of the week)
It wouldn't be intuitive if %U assumed Sunday when weekday provided and Monday
otherwise. There are two separate directives specifically to distinguish these
two cases, so which day of the week is the first one should be determined on
the used directive:
>>> datetime.strptime ('2018 Mon 52', '%Y %a %W')
datetime.datetime(2018, 12, 24, 0, 0)
>>> datetime.strptime ('2018 52', '%Y %W')
datetime.datetime(2018, 12, 24, 0, 0)
>>> datetime.strptime ('2018 Sun 52', '%Y %a %U')
datetime.datetime(2018, 12, 30, 0, 0)
>>> datetime.strptime ('2018 52', '%Y %U')
datetime.datetime(2018, 12, 30, 0, 0)
----------
nosy: +sergey-bon
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue30802>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com