Skip to content

Commit cccd73d

Browse files
miss-islingtonTahomaSofthugovk
authored
[3.11] gh-115315: Update time.rst to include microseconds field (%f) in chart (GH-115316) (#115991)
Co-authored-by: Tahoma Software <[email protected]> Co-authored-by: Hugo van Kemenade <[email protected]>
1 parent c562f5a commit cccd73d

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

Doc/library/time.rst

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -428,6 +428,10 @@ Functions
428428
| ``%d`` | Day of the month as a decimal number [01,31]. | |
429429
| | | |
430430
+-----------+------------------------------------------------+-------+
431+
| ``%f`` | Microseconds as a decimal number | \(1) |
432+
| | [000000,999999]. | |
433+
| | | |
434+
+-----------+------------------------------------------------+-------+
431435
| ``%H`` | Hour (24-hour clock) as a decimal number | |
432436
| | [00,23]. | |
433437
+-----------+------------------------------------------------+-------+
@@ -443,13 +447,13 @@ Functions
443447
| ``%M`` | Minute as a decimal number [00,59]. | |
444448
| | | |
445449
+-----------+------------------------------------------------+-------+
446-
| ``%p`` | Locale's equivalent of either AM or PM. | \(1) |
450+
| ``%p`` | Locale's equivalent of either AM or PM. | \(2) |
447451
| | | |
448452
+-----------+------------------------------------------------+-------+
449-
| ``%S`` | Second as a decimal number [00,61]. | \(2) |
453+
| ``%S`` | Second as a decimal number [00,61]. | \(3) |
450454
| | | |
451455
+-----------+------------------------------------------------+-------+
452-
| ``%U`` | Week number of the year (Sunday as the first | \(3) |
456+
| ``%U`` | Week number of the year (Sunday as the first | \(4) |
453457
| | day of the week) as a decimal number [00,53]. | |
454458
| | All days in a new year preceding the first | |
455459
| | Sunday are considered to be in week 0. | |
@@ -460,7 +464,7 @@ Functions
460464
| ``%w`` | Weekday as a decimal number [0(Sunday),6]. | |
461465
| | | |
462466
+-----------+------------------------------------------------+-------+
463-
| ``%W`` | Week number of the year (Monday as the first | \(3) |
467+
| ``%W`` | Week number of the year (Monday as the first | \(4) |
464468
| | day of the week) as a decimal number [00,53]. | |
465469
| | All days in a new year preceding the first | |
466470
| | Monday are considered to be in week 0. | |
@@ -495,17 +499,23 @@ Functions
495499
Notes:
496500

497501
(1)
502+
The ``%f`` format directive only applies to :func:`strptime`,
503+
not to :func:`strftime`. However, see also :meth:`datetime.datetime.strptime` and
504+
:meth:`datetime.datetime.strftime` where the ``%f`` format directive
505+
:ref:`applies to microseconds <format-codes>`.
506+
507+
(2)
498508
When used with the :func:`strptime` function, the ``%p`` directive only affects
499509
the output hour field if the ``%I`` directive is used to parse the hour.
500510

501511
.. _leap-second:
502512

503-
(2)
513+
(3)
504514
The range really is ``0`` to ``61``; value ``60`` is valid in
505515
timestamps representing `leap seconds`_ and value ``61`` is supported
506516
for historical reasons.
507517

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

0 commit comments

Comments
 (0)