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: strftime incorrectly processes DST flag when passed time touples
Type: behavior Stage:
Components: Library (Lib) Versions: Python 2.7
process
Status: closed Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: jonathan.cervidae, r.david.murray, terry.reedy
Priority: normal Keywords:

Created on 2009-06-01 17:38 by jonathan.cervidae, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (5)
msg88659 - (view) Author: Jonathan (jonathan.cervidae) Date: 2009-06-01 17:38
>>> import time
>>> time.strftime("%FT%T%z")
'2009-06-01T18:35:42+0100'
>>> # Expect to see +0100
>>> time.strftime("%FT%T%z",time.localtime())
'2009-06-01T18:35:42+0000'
>>> time.strftime("%FT%T%Z",time.localtime())
'2009-06-01T18:35:42BST'
>>> made_up_time = list(time.localtime())
>>> made_up_time
[2009, 6, 1, 18, 35, 48, 0, 152, 1]
>>> made_up_time[1] = 2
>>> made_up_time=tuple(made_up_time)
>>> time.strftime("%FT%T%z",made_up_time)
'2009-02-01T18:35:48+0000'
>>> # Expect to see GMT or UTC, whatever strftime wants to call it.
>>> time.strftime("%FT%T%Z",made_up_time)
'2009-02-01T18:35:48BST'
>>>
msg88660 - (view) Author: Jonathan (jonathan.cervidae) Date: 2009-06-01 17:39
Actually, I didn't change the DST flag in the second test, the second
commented bug is invalid, only the first one is correct.
msg88661 - (view) Author: Jonathan (jonathan.cervidae) Date: 2009-06-01 17:53
kludged_zone = ("+" if time.altzone < 0 else '-') +
time.strftime("%H%M",time.gmtime(abs(time.altzone)))
time_zone_format_string = time_zone_format.replace("%z", kludged_zone)
msg112684 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2010-08-03 21:10
It is not clear to me what you think is a bug. Please give actual output, what you expect (in full), and reference to doc.
I cannot test in 3.1 as that format is no longer legal.
msg162579 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2012-06-10 02:31
Closing because of lack of response.
History
Date User Action Args
2022-04-11 14:56:49adminsetgithub: 50415
2012-06-10 02:31:09r.david.murraysetstatus: pending -> closed
nosy: + r.david.murray
messages: + msg162579

2010-08-03 21:10:08terry.reedysetstatus: open -> pending
versions: + Python 2.7, - Python 2.5
nosy: + terry.reedy

messages: + msg112684

components: + Library (Lib), - Extension Modules
2009-06-01 17:53:26jonathan.cervidaesetmessages: + msg88661
2009-06-01 17:39:58jonathan.cervidaesetmessages: + msg88660
2009-06-01 17:38:19jonathan.cervidaecreate