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.

Title: strptime and week numbers without week days
Type: enhancement Stage:
Components: Library (Lib) Versions: Python 3.9
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: Jaap van der Velde
Priority: normal Keywords:

Created on 2021-05-27 22:12 by Jaap van der Velde, last changed 2022-04-11 14:59 by admin.

Messages (1)
msg394611 - (view) Author: Jaap van der Velde (Jaap van der Velde) Date: 2021-05-27 22:12
When running:
datetime.strptime('2013 23', '%Y %W')
The result is `datetime.datetime(2013, 1, 1, 0, 0)`. When running:
datetime.strptime('2013 23 1', '%Y %W %w')
The result is `datetime.datetime(2013, 6, 10, 0, 0)`.

It seems that `%W` is ignored, unless `%w` is also provided. But instead of throwing an error, a result is returned that is needlessly inaccurate. It could (and should?) return the first day of the week as a default, if an error is undesirable. Similar to:
datetime.strptime('2013 3', '%Y %m')
Date User Action Args
2022-04-11 14:59:46adminsetgithub: 88421
2021-05-27 22:12:07Jaap van der Veldecreate