# 获取今天零点的时间戳
# 获取当前时间戳,取余一天的秒数86400,得到今天过了多少秒
# 用当前的时间戳减去今天过去的秒数,得到今天零点的时间戳
# 注意要减去time.timezone获取当前时区的时间戳
import time
from datetime import datetime
now_time = int(time.time())
day_time = now_time - (now_time - time.timezone) % 86400
zero_time = datetime.fromtimestamp(day_time)
标签:datetime,获取,今天,time,零点,now
From: https://www.cnblogs.com/bitterteaer/p/17865199.html