Is a day always 86,400 epoch seconds long?

前端 未结 4 748
一整个雨季
一整个雨季 2021-01-01 08:35

While reviewing my past answers, I noticed I\'d proposed code such as this:

import time

def dates_between(start, end):
  # muck around between the 9k+ time          


        
4条回答
  •  南方客
    南方客 (楼主)
    2021-01-01 09:33

    In all time zones that "support" daylight savings time, you'll get two days a year that don't have 24h. They'll have 25h or 23h respectively. And don't even think of hardcoding those dates. They change every year, and between time zones.

    Oh, and here's a list of 34 other reasons that you hadn't thought about, and why you shouldn't do what you're doing.

提交回复
热议问题