@@ -428,6 +428,10 @@ Functions
428
428
| ``%d `` | Day of the month as a decimal number [01,31]. | |
429
429
| | | |
430
430
+-----------+------------------------------------------------+-------+
431
+ | ``%f `` | Microseconds as a decimal number | \( 1) |
432
+ | | [000000,999999]. | |
433
+ | | | |
434
+ +-----------+------------------------------------------------+-------+
431
435
| ``%H `` | Hour (24-hour clock) as a decimal number | |
432
436
| | [00,23]. | |
433
437
+-----------+------------------------------------------------+-------+
@@ -443,13 +447,13 @@ Functions
443
447
| ``%M `` | Minute as a decimal number [00,59]. | |
444
448
| | | |
445
449
+-----------+------------------------------------------------+-------+
446
- | ``%p `` | Locale's equivalent of either AM or PM. | \( 1 ) |
450
+ | ``%p `` | Locale's equivalent of either AM or PM. | \( 2 ) |
447
451
| | | |
448
452
+-----------+------------------------------------------------+-------+
449
- | ``%S `` | Second as a decimal number [00,61]. | \( 2 ) |
453
+ | ``%S `` | Second as a decimal number [00,61]. | \( 3 ) |
450
454
| | | |
451
455
+-----------+------------------------------------------------+-------+
452
- | ``%U `` | Week number of the year (Sunday as the first | \( 3 ) |
456
+ | ``%U `` | Week number of the year (Sunday as the first | \( 4 ) |
453
457
| | day of the week) as a decimal number [00,53]. | |
454
458
| | All days in a new year preceding the first | |
455
459
| | Sunday are considered to be in week 0. | |
@@ -460,7 +464,7 @@ Functions
460
464
| ``%w `` | Weekday as a decimal number [0(Sunday),6]. | |
461
465
| | | |
462
466
+-----------+------------------------------------------------+-------+
463
- | ``%W `` | Week number of the year (Monday as the first | \( 3 ) |
467
+ | ``%W `` | Week number of the year (Monday as the first | \( 4 ) |
464
468
| | day of the week) as a decimal number [00,53]. | |
465
469
| | All days in a new year preceding the first | |
466
470
| | Monday are considered to be in week 0. | |
@@ -495,17 +499,23 @@ Functions
495
499
Notes:
496
500
497
501
(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)
498
508
When used with the :func: `strptime ` function, the ``%p `` directive only affects
499
509
the output hour field if the ``%I `` directive is used to parse the hour.
500
510
501
511
.. _leap-second :
502
512
503
- (2 )
513
+ (3 )
504
514
The range really is ``0 `` to ``61 ``; value ``60 `` is valid in
505
515
timestamps representing `leap seconds `_ and value ``61 `` is supported
506
516
for historical reasons.
507
517
508
- (3 )
518
+ (4 )
509
519
When used with the :func: `strptime ` function, ``%U `` and ``%W `` are only used in
510
520
calculations when the day of the week and the year are specified.
511
521
0 commit comments