Fin del horario de verano

Trabajar con fechas y horas en Python

Max Shron

Data Scientist and Author

Trabajar con fechas y horas en Python

Trabajar con fechas y horas en Python

Fin del horario de verano

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)
Trabajar con fechas y horas en Python

Fin del horario de verano

(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
Trabajar con fechas y horas en Python

Fin del horario de verano

Trabajar con fechas y horas en Python

Preparing Video For Download...