offset for local time in location is reversed #11791

Closed
opened 2025-12-29 21:49:56 +01:00 by adam · 2 comments
Owner

Originally created by @olafhering on GitHub (Oct 29, 2025).

NetBox Edition

NetBox Community

NetBox Version

NetBox Community v4.4.2-Docker-3.4.1

Python Version

3.10

Steps to Reproduce

Open https://FQDN/dcim/sites/N/, which is a location that has a Time Zone configured.

The configured time zone is:

 Etc/GMT-6 (UTC +0600)
Site time: 2025-10-29 14:33

The page was loaded at Wed Oct 29 08:33:15 UTC 2025. It seems the offset is added, instead of subtracted. I assume this is all generated on the server side.

I have no data about what OS variant is running that Netbox instance, other than the NetBox Community v4.4.2-Docker-3.4.1 string shown in the lower left corner.

Expected Behavior

 Etc/GMT-6 (UTC -0600)
Site time: 2025-10-29 02:33

Observed Behavior

 Etc/GMT-6 (UTC +0600)
Site time: 2025-10-29 14:33
Originally created by @olafhering on GitHub (Oct 29, 2025). ### NetBox Edition NetBox Community ### NetBox Version NetBox Community v4.4.2-Docker-3.4.1 ### Python Version 3.10 ### Steps to Reproduce Open `https://FQDN/dcim/sites/N/`, which is a location that has a `Time Zone` configured. The configured time zone is: ``` Etc/GMT-6 (UTC +0600) Site time: 2025-10-29 14:33 ``` The page was loaded at `Wed Oct 29 08:33:15 UTC 2025`. It seems the offset is added, instead of subtracted. I assume this is all generated on the server side. I have no data about what OS variant is running that Netbox instance, other than the `NetBox Community v4.4.2-Docker-3.4.1` string shown in the lower left corner. ### Expected Behavior ``` Etc/GMT-6 (UTC -0600) Site time: 2025-10-29 02:33 ``` ### Observed Behavior ``` Etc/GMT-6 (UTC +0600) Site time: 2025-10-29 14:33 ```
adam added the netbox label 2025-12-29 21:49:56 +01:00
adam closed this issue 2025-12-29 21:49:56 +01:00
Author
Owner

@jeremystretch commented on GitHub (Oct 29, 2025):

I think you've selected an incorrect timezone. Etc/GMT-6 is actually six hours ahead of GMT. (Note the UTC +0600 in parentheses.) You can verify this in Python directly:

>>> from datetime import datetime
>>> import pytz
>>> gmt_time = datetime.now(pytz.timezone('GMT'))
>>> gmt6_time = datetime.now(pytz.timezone('Etc/GMT-6'))
>>> print(gmt_time.strftime('%Y-%m-%d %H:%M:%S %Z%z'))
2025-10-29 12:27:41 GMT+0000
>>> print(gmt6_time.strftime('%Y-%m-%d %H:%M:%S %Z%z'))
2025-10-29 18:27:41 +06+0600

Additionally, it's recommended to use one of the canonical geographical timezones rather than a raw GMT offset due to regional differences in DST changes and similar caveats.

@jeremystretch commented on GitHub (Oct 29, 2025): I think you've selected an incorrect timezone. `Etc/GMT-6` is actually six hours _ahead_ of GMT. (Note the `UTC +0600` in parentheses.) You can verify this in Python directly: ```python >>> from datetime import datetime >>> import pytz >>> gmt_time = datetime.now(pytz.timezone('GMT')) >>> gmt6_time = datetime.now(pytz.timezone('Etc/GMT-6')) >>> print(gmt_time.strftime('%Y-%m-%d %H:%M:%S %Z%z')) 2025-10-29 12:27:41 GMT+0000 >>> print(gmt6_time.strftime('%Y-%m-%d %H:%M:%S %Z%z')) 2025-10-29 18:27:41 +06+0600 ``` Additionally, it's recommended to use one of the canonical geographical timezones rather than a raw GMT offset due to regional differences in DST changes and similar caveats.
Author
Owner

@olafhering commented on GitHub (Oct 29, 2025):

Thank you for figuring this out for me. No idea why that specific timezone value was chosen, I changed it to US/Mountain (UTC -0600).

@olafhering commented on GitHub (Oct 29, 2025): Thank you for figuring this out for me. No idea why that specific timezone value was chosen, I changed it to ` US/Mountain (UTC -0600)`.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#11791