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: support %z format in time.strftime and _strptime?
Type: enhancement Stage:
Components: Versions: Python 3.2
process
Status: closed Resolution: duplicate
Dependencies: Superseder: datetime.strptime doesn't support %z format ?
View: 6641
Assigned To: belopolsky Nosy List: belopolsky
Priority: normal Keywords:

Created on 2008-10-09 11:27 by skip.montanaro, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (2)
msg74570 - (view) Author: Skip Montanaro (skip.montanaro) * (Python triager) Date: 2008-10-09 11:27
While responding to a c.l.py question just now I discovered that
numeric timezone offsets don't appear to be supported by either the
time.strftime function or the _strptime module.  I noticed on my
Mac's strftime(3) man page that it supports a %Z format for TZ
names and a %z format for numeric tz offsets.  It seems Python
should as well.
msg118701 - (view) Author: Alexander Belopolsky (belopolsky) * (Python committer) Date: 2010-10-14 17:54
Closing as a duplicate of (closed) issue 6641.

time.strftime appears to support %z on the platforms that support it in C strftime:


>>> time.strftime("%z", time.localtime())
'-0400'
History
Date User Action Args
2022-04-11 14:56:40adminsetgithub: 48336
2010-10-15 17:54:36georg.brandlsetstatus: open -> closed
2010-10-14 17:54:47belopolskysetresolution: duplicate
dependencies: - No obvious and correct way to get the time zone offset
superseder: datetime.strptime doesn't support %z format ?
messages: + msg118701
2010-08-07 18:13:21terry.reedysetversions: + Python 3.2, - Python 2.6
2010-06-12 06:05:57belopolskysetassignee: belopolsky
dependencies: + No obvious and correct way to get the time zone offset

nosy: + belopolsky
2010-05-20 20:34:05skip.montanarosetnosy: - skip.montanaro
-> (no value)
2008-10-09 11:27:25skip.montanarocreate