8000 [3.11] gh-115315: Update time.rst to include microseconds field (%f) in chart (GH-115316) by miss-islington · Pull Request #115991 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

[3.11] gh-115315: Update time.rst to include microseconds field (%f) in chart (GH-115316) #115991

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

Merged
merged 1 commit into from
Feb 27, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
gh-115315: Update time.rst to include microseconds field (%f) in chart (
GH-115316)

(cherry picked from commit 3a72fc3)

Co-authored-by: Tahoma Software <bacon@tahoma.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
  • Loading branch information
2 people authored and miss-islington committed Feb 27, 2024
commit adf0aa07884a04175462f0ad7d9195bb17d83d29
22 changes: 16 additions & 6 deletions Doc/library/time.rst
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,10 @@ Functions
| ``%d`` | Day of the month as a decimal number [01,31]. | |
| | | |
+-----------+------------------------------------------------+-------+
| ``%f`` | Microseconds as a decimal number | \(1) |
| | [000000,999999]. | |
| | | |
+-----------+------------------------------------------------+-------+
| ``%H`` | Hour (24-hour clock) as a decimal number | |
| | [00,23]. | |
+-----------+------------------------------------------------+-------+
Expand All @@ -443,13 +447,13 @@ Functions
| ``%M`` | Minute as a decimal number [00,59]. | |
| | | |
+-----------+------------------------------------------------+-------+
| ``%p`` | Locale's equivalent of either AM or PM. | \(1) |
| ``%p`` | Locale's equivalent of either AM or PM. | \(2) |
| | | |
+-----------+------------------------------------------------+-------+
| ``%S`` | Second as a decimal number [00,61]. | \(2) |
| ``%S`` | Second as a decimal number [00,61]. | \(3) |
| | | |
+-----------+------------------------------------------------+-------+
| ``%U`` | Week number of the year (Sunday as the first | \(3) |
| ``%U`` | Week number of the year (Sunday as the first | \(4) |
| | day of the week) as a decimal number [00,53]. | |
| | All days in a new year preceding the first | |
| | Sunday are considered to be in week 0. | |
Expand All @@ -460,7 +464,7 @@ Functions
| ``%w`` | Weekday as a decimal number [0(Sunday),6]. | |
| | | |
+-----------+------------------------------------------------+-------+
| ``%W`` | Week number of the year (Monday as the first | \(3) |
| ``%W`` | Week number of the year (Monday as the first | \(4) |
| | day of the week) as a decimal number [00,53]. | |
| | All days in a new year preceding the first | |
| | Monday are considered to be in week 0. | |
Expand Down Expand Up @@ -495,17 +499,23 @@ Functions
Notes:

(1)
The ``%f`` format directive only applies to :func:`strptime`,
not to :func:`strftime`. However, see also :meth:`datetime.datetime.strptime` and
:meth:`datetime.datetime.strftime` where the ``%f`` format directive
:ref:`applies to microseconds <format-codes>`.

(2)
When used with the :func:`strptime` function, the ``%p`` directive only affects
the output hour field if the ``%I`` directive is used to parse the hour.

.. _leap-second:

(2)
(3)
The range really is ``0`` to ``61``; value ``60`` is valid in
timestamps representing `leap seconds`_ and value ``61`` is supported
for historical reasons.

(3)
(4)
When used with the :func:`strptime` function, ``%U`` and ``%W`` are only used in
calculations when the day of the week and the year are specified.

Expand Down
0