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

gh-100574: add examples/links to the strptime/strftime docs #100575

Merged
merged 3 commits into from
Apr 8, 2023

Conversation

ezio-melotti
Copy link
Member

@ezio-melotti ezio-melotti commented Dec 28, 2022

@ezio-melotti ezio-melotti added type-feature A feature request or enhancement docs Documentation in the Doc dir skip news needs backport to 3.10 only security fixes needs backport to 3.11 only security fixes labels Dec 28, 2022
@ezio-melotti ezio-melotti self-assigned this Dec 28, 2022
@@ -737,18 +737,16 @@ Instance methods:
.. method:: date.strftime(format)

Return a string representing the date, controlled by an explicit format string.
Format codes referring to hours, minutes or seconds will see 0 values. For a
complete list of formatting directives, see
:ref:`strftime-strptime-behavior`.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This ref is converted to the title of the section: strftime() and strptime() Behavior. The actual list of format codes is actually a subsection. Adding a label to the subsection and updating the ref might result in a more readable sentence.

Comment on lines +2323 to +2327
>>> datetime.strptime('31/01/22 23:59:59.999999',
... '%d/%m/%y %H:%M:%S.%f')
datetime.datetime(2022, 1, 31, 23, 59, 59, 999999)
>>> _.strftime('%a %d %b %Y, %I:%M%p')
'Mon 31 Jan 2022, 11:59PM'
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this example I tried to capture as many format codes as possible in a way that makes it easy to find which part corresponds to which code.

Copy link
Member

@hugovk hugovk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hugovk hugovk removed the needs backport to 3.10 only security fixes label Apr 7, 2023
@hugovk hugovk merged commit 3310b94 into python:main Apr 8, 2023
@miss-islington
Copy link
Contributor

Thanks @ezio-melotti for the PR, and @hugovk for merging it 🌮🎉.. I'm working now to backport this PR to: 3.11.
🐍🍒⛏🤖

@bedevere-bot
Copy link

GH-103368 is a backport of this pull request to the 3.11 branch.

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Apr 8, 2023
…pythonGH-100575)

(cherry picked from commit 3310b94)

Co-authored-by: Ezio Melotti <ezio.melotti@gmail.com>
@bedevere-bot bedevere-bot removed the needs backport to 3.11 only security fixes label Apr 8, 2023
miss-islington added a commit that referenced this pull request Apr 8, 2023
…00575)

(cherry picked from commit 3310b94)

Co-authored-by: Ezio Melotti <ezio.melotti@gmail.com>
@ezio-melotti ezio-melotti deleted the strpftime-examples branch April 8, 2023 14:58
warsaw pushed a commit to warsaw/cpython that referenced this pull request Apr 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation in the Doc dir skip news type-feature A feature request or enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants