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