This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Documentation of datetime '%z' format code is odd
Type: Stage: resolved
Components: Documentation Versions: Python 3.8, Python 3.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: docs@python Nosy List: Christophe Nanteuil, belopolsky, docs@python, martin.panter, ned.deily, p-ganssle, xtreak
Priority: normal Keywords: patch

Created on 2018-07-19 21:34 by Christophe Nanteuil, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
datetime.rst.patch Christophe Nanteuil, 2018-07-19 21:34 Patch
Pull Requests
URL Status Linked Edit
PR 8377 merged python-dev, 2018-07-21 14:36
PR 9732 merged miss-islington, 2018-10-05 22:57
Messages (7)
msg321968 - (view) Author: Christophe Nanteuil (Christophe Nanteuil) * Date: 2018-07-19 21:34
In § 8.1.8. "strftime() and strptime() Behavior", the documentation states that "%z" format code is a string of the form '±HHMM[SS[.uuuuuu]]' where uuuuuu is a 2-digit string giving the number of UTC offset microseconds.
I think it's a 6-digit string.
msg322085 - (view) Author: Karthikeyan Singaravelan (xtreak) * (Python committer) Date: 2018-07-21 08:21
Added as part of 018d353c1c8c87767d2335cd884017c2ce12e045 and a fix regarding duplicate words for that part was added at bac2d5ba30339298db7d4caa9c8cd31d807cf081. 

Relevant format string at https://github.com/python/cpython/pull/2896/files#diff-25e2d173c84057d069b7890450714eddR214.

Relevant test case with 6-digit string for microsecond : https://github.com/python/cpython/pull/2896/files#diff-acc40bec51c7de832de3361db3edae52R309.

Table at https://docs.python.org/3.7/library/datetime.html#strftime-and-strptime-behavior could also be updated with microseconds being optional in the second column

%z | UTC offset in the form ±HHMM[SS] (empty string if the object is naive). | (empty), +0000, -0400, +1030

You can raise a GitHub PR for the same.

Thanks
msg322140 - (view) Author: Martin Panter (martin.panter) * (Python committer) Date: 2018-07-22 09:14
FWIW more oddities with this paragraph could be fixed by:

* removing the first “and” from “HH is . . ., [and] MM is . . ., SS is . . . and uuuuuu is”,
* changing the condition for omitting “uuuuuu” from “a whole number of [minutes]” to “seconds”, and
* changing “the [SS parts are] omitted” to singular “SS part is”.
msg322324 - (view) Author: Christophe Nanteuil (Christophe Nanteuil) * Date: 2018-07-24 19:08
PR updated according to Martin Panter comments.
msg327196 - (view) Author: Alexander Belopolsky (belopolsky) * (Python committer) Date: 2018-10-05 22:57
New changeset 92878829c31ab2fc71c60555ce87a5f6cbc876f0 by Alexander Belopolsky (Christophe Nanteuil) in branch 'master':
bpo-34158: Documentation UTC offset update (GH-8377)
https://github.com/python/cpython/commit/92878829c31ab2fc71c60555ce87a5f6cbc876f0
msg327211 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2018-10-06 02:44
New changeset 0991b9bb94036e0f271d223c8db7d81980c76736 by Ned Deily (Miss Islington (bot)) in branch '3.7':
[3.7] bpo-34158: Documentation UTC offset update (GH-8377) (GH-9732)
https://github.com/python/cpython/commit/0991b9bb94036e0f271d223c8db7d81980c76736
msg327803 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2018-10-15 23:14
I assume this can now be closed. Thanks, everyone!
History
Date User Action Args
2022-04-11 14:59:03adminsetgithub: 78339
2018-10-15 23:14:06ned.deilysetstatus: open -> closed
versions: + Python 3.8
messages: + msg327803

resolution: fixed
stage: patch review -> resolved
2018-10-06 02:44:29ned.deilysetnosy: + ned.deily
messages: + msg327211
2018-10-05 22:57:13miss-islingtonsetpull_requests: + pull_request9118
2018-10-05 22:57:06belopolskysetnosy: + belopolsky
messages: + msg327196
2018-07-24 19:08:16Christophe Nanteuilsetmessages: + msg322324
2018-07-23 14:09:10p-gansslesetnosy: + p-ganssle
2018-07-22 09:14:59martin.pantersetnosy: + martin.panter
messages: + msg322140
2018-07-21 14:36:01python-devsetstage: patch review
pull_requests: + pull_request7908
2018-07-21 08:21:32xtreaksetnosy: + xtreak
messages: + msg322085
2018-07-19 21:34:47Christophe Nanteuilcreate