]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
gh-69142: add %:z strftime format code (gh-95983)
authorTW <tw@waldmann-edv.de>
Sun, 28 Aug 2022 21:27:42 +0000 (23:27 +0200)
committerGitHub <noreply@github.com>
Sun, 28 Aug 2022 21:27:42 +0000 (14:27 -0700)
commit023c51d9d8e2fd91069eea2bf12e373f1c71e9d2
treecdd0d6e04e5788ee2fd54faa2dbb4fc6586d8337
parente860e521ec0d84e175269aeb15cf24bd6053ad17
gh-69142: add %:z strftime format code (gh-95983)

datetime.isoformat generates the tzoffset with colons, but there
was no format code to make strftime output the same format.

for simplicity and consistency the %:z formatting behaves mostly
as %z, with the exception of adding colons. this includes the
dynamic behaviour of adding seconds and microseconds only when
needed (when not 0).

this fixes the still open "generate" part of this issue:

https://github.com/python/cpython/issues/69142

Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
Doc/library/datetime.rst
Lib/datetime.py
Lib/test/datetimetester.py
Misc/NEWS.d/next/Library/2022-08-14-18-59-54.gh-issue-69142.6is5Pq.rst [new file with mode: 0644]
Modules/_datetimemodule.c