Skip to content

Commit 7bcef57

Browse files
TahomaSofthugovk
authored andcommitted
pythongh-115315: Update time.rst to include microseconds field (%f) in chart (python#115316)
Co-authored-by: Hugo van Kemenade <[email protected]>
1 parent 95c8705 commit 7bcef57

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
@@ -433,6 +433,10 @@ Functions
433433
| ``%d`` | Day of the month as a decimal number [01,31]. | |
434434
| | | |
435435
+-----------+------------------------------------------------+-------+
436+
| ``%f`` | Microseconds as a decimal number | \(1) |
437+
| | [000000,999999]. | |
438+
| | | |
439+
+-----------+------------------------------------------------+-------+
436440
| ``%H`` | Hour (24-hour clock) as a decimal number | |
437441
| | [00,23]. | |
438442
+-----------+------------------------------------------------+-------+
@@ -448,13 +452,13 @@ Functions
448452
| ``%M`` | Minute as a decimal number [00,59]. | |
449453
| | | |
450454
+-----------+------------------------------------------------+-------+
451-
| ``%p`` | Locale's equivalent of either AM or PM. | \(1) |
455+
| ``%p`` | Locale's equivalent of either AM or PM. | \(2) |
452456
| | | |
453457
+-----------+------------------------------------------------+-------+
454-
| ``%S`` | Second as a decimal number [00,61]. | \(2) |
458+
| ``%S`` | Second as a decimal number [00,61]. | \(3) |
455459
| | | |
456460
+-----------+------------------------------------------------+-------+
457-
| ``%U`` | Week number of the year (Sunday as the first | \(3) |
461+
| ``%U`` | Week number of the year (Sunday as the first | \(4) |
458462
| | day of the week) as a decimal number [00,53]. | |
459463
| | All days in a new year preceding the first | |
460464
| | Sunday are considered to be in week 0. | |
@@ -465,7 +469,7 @@ Functions
465469
| ``%w`` | Weekday as a decimal number [0(Sunday),6]. | |
466470
| | | |
467471
+-----------+------------------------------------------------+-------+
468-
| ``%W`` | Week number of the year (Monday as the first | \(3) |
472+
| ``%W`` | Week number of the year (Monday as the first | \(4) |
469473
| | day of the week) as a decimal number [00,53]. | |
470474
| | All days in a new year preceding the first | |
471475
| | Monday are considered to be in week 0. | |
@@ -500,17 +504,23 @@ Functions
500504
Notes:
501505

502506
(1)
507+
The ``%f`` format directive only applies to :func:`strptime`,
508+
not to :func:`strftime`. However, see also :meth:`datetime.datetime.strptime` and
509+
:meth:`datetime.datetime.strftime` where the ``%f`` format directive
510+
:ref:`applies to microseconds <format-codes>`.
511+
512+
(2)
503513
When used with the :func:`strptime` function, the ``%p`` directive only affects
504514
the output hour field if the ``%I`` directive is used to parse the hour.
505515

506516
.. _leap-second:
507517

508-
(2)
518+
(3)
509519
The range really is ``0`` to ``61``; value ``60`` is valid in
510520
timestamps representing `leap seconds`_ and value ``61`` is supported
511521
for historical reasons.
512522

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

0 commit comments

Comments
 (0)