Last active
February 13, 2024 19:22
-
-
Save kgriffs/0321be9e627bf42a6dae31028a2523e3 to your computer and use it in GitHub Desktop.
Revisions
-
kgriffs revised this gist
Feb 13, 2024 . 1 changed file with 4 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -9,7 +9,9 @@ print("Original DST Active Offset (America/New_York):", dt_aware_dst_active.dst()) print("Original DST Active (America/New_York):", dt_aware_dst_active) print("To UTC, DST Active (America/New_York):", dt_aware_dst_active.astimezone(pytz.utc)) print("Roundtrip, DST Active (America/New_York):", dt_aware_dst_active.astimezone(pytz.utc).astimezone(tz_ny)) print() print("Original DST Inactive Offset (America/New_York):", dt_aware_dst_inactive.dst()) print("Original DST Inactive (America/New_York):", dt_aware_dst_inactive) print("To UTC, DST Inactive (America/New_York):", dt_aware_dst_inactive.astimezone(pytz.utc)) print("Roundtrip, DST Inactive (America/New_York):", dt_aware_dst_inactive.astimezone(pytz.utc).astimezone(tz_ny)) -
kgriffs created this gist
Feb 13, 2024 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,15 @@ import datetime import pytz tz_ny = pytz.timezone('America/New_York') dt_aware_dst_active = tz_ny.localize(datetime.datetime(2023, 5, 1, 12, 0)) dt_aware_dst_inactive = tz_ny.localize(datetime.datetime(2023, 12, 1, 12, 0)) print("Original DST Active Offset (America/New_York):", dt_aware_dst_active.dst()) print("Original DST Active (America/New_York):", dt_aware_dst_active) print("To UTC, DST Active (America/New_York):", dt_aware_dst_active.astimezone(pytz.utc)) print() print("Original DST Inactive Offset (America/New_York):", dt_aware_dst_inactive.dst()) print("Original DST Inctive (America/New_York):", dt_aware_dst_inactive) print("To UTC, DST Inctive (America/New_York):", dt_aware_dst_inactive.astimezone(pytz.utc))