Created
January 16, 2022 17:46
-
-
Save xcsrz/e8dfa82d1222c0fff47427a5a0a034b3 to your computer and use it in GitHub Desktop.
Sometimes you just want a list of timezones with their offsets. From this you can find the offset for a given timezone on a specific date.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from datetime import datetime | |
import pytz | |
UTC = pytz.timezone("UTC") | |
for tzn in pytz.common_timezones: | |
tz = pytz.timezone(tzn) | |
print( | |
tzn, | |
UTC.localize(datetime(2020, 12, 15)).astimezone(tz).strftime('%z'), | |
UTC.localize(datetime(2020, 6, 15)).astimezone(tz).strftime('%z'), | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment