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.

Title: Timezone 'Etc/GMT-5' functions as Timezone 'Etc/GMT+5'
Type: behavior Stage: resolved
Components: Library (Lib) Versions: Python 3.8
Status: closed Resolution: third party
Dependencies: Superseder:
Assigned To: Nosy List: Dennis Sweeney, killv5, mark.dickinson
Priority: normal Keywords:

Created on 2021-01-28 17:26 by killv5, last changed 2022-04-11 14:59 by admin. This issue is now closed.

File name Uploaded Description Edit killv5, 2021-01-28 17:26
Messages (3)
msg385871 - (view) Author: (killv5) Date: 2021-01-28 17:26
When I run the code attached I get the results below. This is not the expected behavior because I was expecting the GMT-5 timezone instead of GMT+5. When I tried to use GMT-5 I had the result of GMT+5. Luckily the timezone names still work ('EST','CST', etc.)

2021-01-28 19:10:47+05:00
msg385875 - (view) Author: Dennis Sweeney (Dennis Sweeney) * (Python committer) Date: 2021-01-28 18:32
I reproduced something similar in 3.9 with standard library modules:

>>> from datetime import datetime
>>> from zoneinfo import ZoneInfo
>>> zone = ZoneInfo(key='Etc/GMT-3')
>>> zone.tzname(datetime(2021, 1, 28))
msg385879 - (view) Author: Mark Dickinson (mark.dickinson) * (Python committer) Date: 2021-01-28 20:00
This isn't a Python bug - it's a quirk of the way that the "Etc/***" timezones are defined. See for example

> In order to conform with the POSIX style, those zone names beginning with "Etc/GMT" have their sign reversed from the standard ISO 8601 convention. In the "Etc" area, zones west of GMT have a positive sign and those east have a negative sign in their name (e.g "Etc/GMT-14" is 14 hours ahead of GMT).
Date User Action Args
2022-04-11 14:59:40adminsetgithub: 87223
2021-01-28 20:00:03mark.dickinsonsetstatus: open -> closed

nosy: + mark.dickinson
messages: + msg385879

resolution: third party
stage: resolved
2021-01-28 18:32:56Dennis Sweeneysetnosy: + Dennis Sweeney
messages: + msg385875
2021-01-28 17:26:53killv5create