from zoneinfo import ZoneInfo from datetime import datetime, timedelta # same autumn transition, same UTC offsets OSL = ZoneInfo("Europe/Oslo") BER = ZoneInfo("Europe/Berlin") # same point in time osl_f0 = datetime(2020, 10, 25, 2, 30, fold=0, tzinfo=OSL) ber_f0 = datetime(2020, 10, 25, 2, 30, fold=0, tzinfo=BER) assert osl_f0 - ber_f0 == timedelta(0) # same point in time, one hour later osl_f1 = datetime(2020, 10, 25, 2, 31, fold=1, tzinfo=OSL) ber_f1 = datetime(2020, 10, 25, 2, 31, fold=1, tzinfo=BER) assert osl_f1 - ber_f1 == timedelta(0) print('All these should be 1:01:00 apart') print(osl_f1 - osl_f0,'Oslo_1 - Oslo_0') print(ber_f1 - osl_f0,'Berlin_1 - Oslo_0') print(osl_f1 - ber_f0,'Oslo_1 - Berlin_0') print(ber_f1 - ber_f0,'Berlin_1 - Berlin_0')