@@ -2362,7 +2362,7 @@ requires, and these work on all platforms with a standard C implementation.
2362
2362
| | string if the object is | +063415, | |
2363
2363
| | naive). | -030712.345216 | |
2364
2364
+-----------+--------------------------------+------------------------+-------+
2365
- | ``%Z `` | Time zone name (empty string | (empty), UTC, EST, CST | |
2365
+ | ``%Z `` | Time zone name (empty string | (empty), UTC, GMT | \( 6) |
2366
2366
| | if the object is naive). | | |
2367
2367
+-----------+--------------------------------+------------------------+-------+
2368
2368
| ``%j `` | Day of the year as a | 001, 002, ..., 366 | \( 9) |
@@ -2533,9 +2533,18 @@ Notes:
2533
2533
In addition, providing ``'Z' `` is identical to ``'+00:00' ``.
2534
2534
2535
2535
``%Z ``
2536
- If :meth: `tzname ` returns ``None ``, ``%Z `` is replaced by an empty
2537
- string. Otherwise ``%Z `` is replaced by the returned value, which must
2538
- be a string.
2536
+ In :meth: `strftime `, ``%Z `` is replaced by an empty string if
2537
+ :meth: `tzname ` returns ``None ``; otherwise ``%Z `` is replaced by the
2538
+ returned value, which must be a string.
2539
+
2540
+ :meth: `strptime ` only accepts certain values for ``%Z ``:
2541
+
2542
+ 1. any value in ``time.tzname `` for your machine's locale
2543
+ 2. the hard-coded values ``UTC `` and ``GMT ``
2544
+
2545
+ So someone living in Japan may have ``JST ``, ``UTC ``, and ``GMT `` as
2546
+ valid values, but probably not ``EST ``. It will raise ``ValueError `` for
2547
+ invalid values.
2539
2548
2540
2549
.. versionchanged :: 3.2
2541
2550
When the ``%z `` directive is provided to the :meth: `strptime ` method, an
0 commit comments