tz1 = pytz.timezone('UTC')
dt1 = tz1.localize(datetime(2020, 10, 25,0,38,43,454000))
tz2 = pytz.timezone('Europe/London')
dt2 = tz2.localize(datetime(2020, 10, 25,1,38,43,454000))
print(dt1)
print(dt2)
print(dt1==dt2)
It returns:
2020-10-25 00:38:43.454000+00:00
2020-10-25 01:38:43.454000+00:00
False
tz1 = pytz.timezone('UTC')
dt1 = tz1.localize(datetime(2020, 10, 25,0,38,43,454000))
tz2 = pytz.timezone('Europe/London')
dt2 = tz2.localize(datetime(2020, 10, 25,0,38,43,454000))
print(dt1)
print(dt2)
print(dt1==dt2)
returns:
2020-10-25 00:38:43.454000+00:00
2020-10-25 00:38:43.454000+01:00
False
How can I make dt1==dt2
return True while only adjusting dt2
?
Note: 2020/10/25 is the day when DST ends in 2020.