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
base: main
Are you sure you want to change the base?
Conversation
@@ -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`. |
There was a problem hiding this comment.
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.
>>> 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' |
There was a problem hiding this comment.
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.
strptime
/strftime
format code examples #100574