@@ -2658,10 +2658,13 @@ requires, and these work on all supported platforms.
26582658| ``%Y `` | Year with century as a decimal | 0001, 0002, ..., 2013, | \( 2) |
26592659| | number. | 2014, ..., 9998, 9999 | |
26602660+-----------+--------------------------------+------------------------+-------+
2661- | ``%z `` | UTC offset in the form | (empty), +0000, | \( 6) |
2662- | | ``±HH[MM[SS[.ffffff]]] `` | -0400, +1030, | |
2663- | | (empty string if the object is | +063415, +04, | |
2664- | | naive). | -030712.345216 | |
2661+ | ``%z `` | UTC offset. | (empty), +0000, | \( 6) |
2662+ | | ``strptime() `` accepts | -0400, +1030, | |
2663+ | | ``±HH[MM[SS[.ffffff]]] ``; | +063415, +04, | |
2664+ | | ``strftime() `` outputs | -030712.345216 | |
2665+ | | ``±HHMM[SS[.ffffff]] `` | | |
2666+ | | (empty string if the object is | | |
2667+ | | naive). | | |
26652668+-----------+--------------------------------+------------------------+-------+
26662669| ``%Z `` | Time zone name (empty string | (empty), UTC, GMT | \( 6) |
26672670| | if the object is naive). | | |
@@ -2683,10 +2686,13 @@ convenience.
26832686| | number, zero-padded to 6 | 999999 | |
26842687| | digits. | | |
26852688+-----------+--------------------------------+------------------------+-------+
2686- | ``%:z `` | UTC offset in the form | (empty), +00:00, | \( 6) |
2687- | | ``±HH[:MM[:SS[.ffffff]]] `` | -04:00, +10:30, | |
2688- | | (empty string if the object is | +06:34:15, +04, | |
2689- | | naive). | -03:07:12.345216 | |
2689+ | ``%:z `` | UTC offset. | (empty), +00:00, | \( 6) |
2690+ | | ``strptime() `` accepts | -04:00, +10:30, | |
2691+ | | ``±HH[:MM[:SS[.ffffff]]] ``; | +06:34:15, +04, | |
2692+ | | ``strftime() `` outputs | -03:07:12.345216 | |
2693+ | | ``±HH:MM[:SS[.ffffff]] `` | | |
2694+ | | (empty string if the object is | | |
2695+ | | naive). | | |
26902696+-----------+--------------------------------+------------------------+-------+
26912697
26922698The full set of format codes supported varies across platforms, because Python
@@ -2871,6 +2877,10 @@ Notes:
28712877 aware :class: `.datetime ` object will be produced. The ``tzinfo `` of the
28722878 result will be set to a :class: `timezone ` instance.
28732879
2880+ .. versionchanged :: next
2881+ The ``%z `` and ``%:z `` directives in :meth: `~.datetime.strptime `
2882+ now accept time zone offsets in ``±HH `` format (for example, ``+03 ``).
2883+
28742884(7)
28752885 When used with the :meth: `~.datetime.strptime ` method, ``%U `` and ``%W `` are only used
28762886 in calculations when the day of the week and the calendar year (``%Y ``)
0 commit comments