Timezone-naive and -aware datetimes and conversion from/to timestamps give me big head aches from time to time. Just now I found a new strange behavior:
datetime.datetime.fromtimestamp(pytz.timezone('Europe/Berlin').localize(datetime.datetime(2020, 1, 1)).timestamp())
results in
datetime.datetime(2020, 1, 1, 0, 0)
whereas
datetime.datetime.fromtimestamp(datetime.datetime(2020, 1, 1, tzinfo=pytz.timezone('Europe/Berlin')).timestamp())
results in a strange 7 minute shift:
datetime.datetime(2020, 1, 1, 0, 7)
I have no idea what is going on, as I thought both ways (.localize and tzinfo) are good ways to make a datetime timezone-aware, but I cannot explain this strange 7 minute shift. Anyone?