डे लाइट सेविंग टाइम का अंत

Python में Dates और Times के साथ काम करना

Max Shron

Data Scientist and Author

Python में Dates और Times के साथ काम करना

Python में Dates और Times के साथ काम करना

डे लाइट सेविंग टाइम का अंत

eastern = tz.gettz('US/Eastern')
# 2017-11-05 01:00:00
first_1am = datetime(2017, 11, 5, 1, 0, 0, 
                     tzinfo = eastern)

tz.datetime_ambiguous(first_1am)
True
# 2017-11-05 01:00:00 again
second_1am = datetime(2017, 11, 5, 1, 0, 0, 
                      tzinfo = eastern)
second_1am = tz.enfold(second_1am)
Python में Dates और Times के साथ काम करना

डे लाइट सेविंग टाइम का अंत

(first_1am - second_1am).total_seconds()
0.0
first_1am = first_1am.astimezone(tz.UTC)
second_1am = second_1am.astimezone(tz.UTC)

(second_1am - first_1am).total_seconds()
3600.0
Python में Dates और Times के साथ काम करना

डे लाइट सेविंग टाइम का अंत

Python में Dates और Times के साथ काम करना

Preparing Video For Download...