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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

ezio-melotti
Copy link
Member

@ezio-melotti ezio-melotti commented 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

@ezio-melotti ezio-melotti Dec 28, 2022

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.

Doc/library/datetime.rst Outdated Show resolved Hide resolved
>>> 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

@ezio-melotti ezio-melotti Dec 28, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants