python / cpython

The Python programming language
https://www.python.org
Other
62.49k stars 30k forks source link

Please officially support %G, %V and %u directives in time library #89762

Open fa05dd5d-0e85-4c41-8aac-f4dc856402ce opened 2 years ago

fa05dd5d-0e85-4c41-8aac-f4dc856402ce commented 2 years ago
BPO 45599

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields: ```python assignee = None closed_at = None created_at = labels = ['type-feature', 'library', '3.11'] title = 'Please officially support %G, %V and %u directives in time library' updated_at = user = 'https://bugs.python.org/Raphael' ``` bugs.python.org fields: ```python activity = actor = 'Raphael' assignee = 'none' closed = False closed_date = None closer = None components = ['Library (Lib)'] creation = creator = 'Raphael' dependencies = [] files = [] hgrepos = [] issue_num = 45599 keywords = [] message_count = 1.0 messages = ['404933'] nosy_count = 1.0 nosy_names = ['Raphael'] pr_nums = [] priority = 'normal' resolution = None stage = None status = 'open' superseder = None type = 'enhancement' url = 'https://bugs.python.org/issue45599' versions = ['Python 3.11'] ```

fa05dd5d-0e85-4c41-8aac-f4dc856402ce commented 2 years ago

In the time library documentation (https://docs.python.org/3/library/time.html) the directives %G, %V and %u for strftime() are missing, although they work (at least for me in Linux Mint):

$ python3
Python 3.8.10 (default, Sep 28 2021, 16:10:42) 
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from time import strftime
>>> strftime("%G-W%V-%u")
'2021-W42-7'

This seems to be officially supported by the datetime library since https://bugs.python.org/issue12006 or at least there is a section for the ISO 8601 week directives in the datetime documentation: https://docs.python.org/3/library/datetime.html#strftime-and-strptime-format-codes

I would like to see the same for the time library.