使用python计算当天零点时间
- import time
- print(time.time())
- print(int(time.time() - time.timezone)% 86400)
- print(time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(time.time())))
- print(time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(int(time.time() - time.timezone))))
- print(time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(int(time.time() - time.timezone)% 86400)))
- print(time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(int(time.time() - int(time.time() - time.timezone) % 86400))))
-
- ------------------------------------------------------------
- 1668864447.49649
- 77247
- 2022-11-19 21:27:27
- 2022-11-20 05:27:27
- 1970-01-02 05:27:27
- 2022-11-19 00:00:00