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, 3, 29, 1, 59, tzinfo=OSL) ber_f0 = datetime(2020, 3, 29, 1, 59, tzinfo=BER) assert osl_f0 - ber_f0 == timedelta(0) # same point in time, two minutes later osl_f1 = datetime(2020, 3, 29, 3, 1, tzinfo=OSL) ber_f1 = datetime(2020, 3, 29, 3, 1, tzinfo=BER) assert osl_f1 - ber_f1 == timedelta(0) print('All these should be 0:02: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')