pytz difference of 2 datetimes in seconds? (Different time zones)

后端 未结 2 1143
佛祖请我去吃肉
佛祖请我去吃肉 2021-01-28 00:35

I have 2 datetime objects with 2 different time zones:

datetime1 = 18:26:23, with tzinfo = UTC

datetime2 = 14:30:00, with tzinfo = US/Eastern

Both dates

2条回答
  •  时光取名叫无心
    2021-01-28 00:59

    doc for timedelta: https://docs.python.org/2/library/datetime.html

    def make_timedelta(seconds):
            return timedelta(days=seconds // 86399, seconds=seconds % 86399)
    

提交回复
热议问题