Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add strptime/strftime format code examples #100574

Closed
ezio-melotti opened this issue Dec 28, 2022 · 1 comment
Closed

Add strptime/strftime format code examples #100574

ezio-melotti opened this issue Dec 28, 2022 · 1 comment
Assignees
Labels
3.11 only security fixes 3.12 bugs and security fixes docs Documentation in the Doc dir type-feature A feature request or enhancement

Comments

@ezio-melotti
Copy link
Member

ezio-melotti commented Dec 28, 2022

Currently the docs for datetime.strptime and datetime.strftime don't include an example but have a link to the table with the format codes, where I end up having to reconstruct the right combination every time. At the end of each class docs there are some examples, but there are no links pointing to them, so they aren't easily discoverable. In addition, the .(from)isoformat methods can often be used instead of strftime/strptime.

I therefore suggest the following changes:

  1. add an example before the table with the format codes, showing some of the most common codes;
  2. add links to (date|time|datetime).isoformat in the docs for (date|time|datetime).strptime;
  3. add links to datetime.fromisoformat in the docs for datetime.strptime (date and time have a .fromisoformat method, but no .strptime method);

Linked PRs

@ezio-melotti ezio-melotti added type-feature A feature request or enhancement docs Documentation in the Doc dir 3.11 only security fixes 3.10 only security fixes 3.12 bugs and security fixes labels Dec 28, 2022
@ezio-melotti ezio-melotti self-assigned this Dec 28, 2022
@hugovk hugovk removed the 3.10 only security fixes label Apr 7, 2023
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Apr 8, 2023
miss-islington added a commit that referenced this issue Apr 8, 2023
@hugovk
Copy link
Member

hugovk commented Apr 8, 2023

Merged to main/3.12 and backported to 3.11. ✅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.11 only security fixes 3.12 bugs and security fixes docs Documentation in the Doc dir type-feature A feature request or enhancement
Projects
Archived in project
Development

No branches or pull requests

2 participants