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

Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
This commit is contained in:
Tahoma Software 2024-02-27 08:33:05 -05:00 committed by GitHub
parent 6ecfcfe894
commit 3a72fc36f9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -433,6 +433,10 @@ Functions
| ``%d`` | Day of the month as a decimal number [01,31]. | | | ``%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 | | | ``%H`` | Hour (24-hour clock) as a decimal number | |
| | [00,23]. | | | | [00,23]. | |
+-----------+------------------------------------------------+-------+ +-----------+------------------------------------------------+-------+
@ -448,13 +452,13 @@ Functions
| ``%M`` | Minute as a decimal number [00,59]. | | | ``%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]. | | | | day of the week) as a decimal number [00,53]. | |
| | All days in a new year preceding the first | | | | All days in a new year preceding the first | |
| | Sunday are considered to be in week 0. | | | | Sunday are considered to be in week 0. | |
@ -465,7 +469,7 @@ Functions
| ``%w`` | Weekday as a decimal number [0(Sunday),6]. | | | ``%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]. | | | | day of the week) as a decimal number [00,53]. | |
| | All days in a new year preceding the first | | | | All days in a new year preceding the first | |
| | Monday are considered to be in week 0. | | | | Monday are considered to be in week 0. | |
@ -500,17 +504,23 @@ Functions
Notes: Notes:
(1) (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 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. the output hour field if the ``%I`` directive is used to parse the hour.
.. _leap-second: .. _leap-second:
(2) (3)
The range really is ``0`` to ``61``; value ``60`` is valid in The range really is ``0`` to ``61``; value ``60`` is valid in
timestamps representing `leap seconds`_ and value ``61`` is supported timestamps representing `leap seconds`_ and value ``61`` is supported
for historical reasons. for historical reasons.
(3) (4)
When used with the :func:`strptime` function, ``%U`` and ``%W`` are only used in 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. calculations when the day of the week and the year are specified.