Skip to content

Add strptime/strftime format code examples #100574

Closed
@ezio-melotti

Description

@ezio-melotti

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

Metadata

Metadata

Assignees

Labels

3.11only security fixes3.12bugs and security fixesdocsDocumentation in the Doc dirtype-featureA feature request or enhancement

Projects

  • Status

    Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions