You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
support %z format in time.strftime and _strptime? #48336
bpo-6641: datetime.strptime doesn't support %z format ?
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee='https://github.com/abalkin'closed_at=<Date2010-10-15.17:54:36.396>created_at=<Date2008-10-09.11:27:25.421>labels= ['type-feature']
title='support %z format in time.strftime and _strptime?'updated_at=<Date2010-10-15.17:54:36.395>user='https://github.com/smontanaro'
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.
Activity
smontanaro commentedon Oct 9, 2008
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.
abalkin commentedon Oct 14, 2010
Closing as a duplicate of (closed) bpo-6641.
time.strftime appears to support %z on the platforms that support it in C strftime:
>>> time.strftime("%z", time.localtime()) '-0400'