获取当前时间减去8个小时
import time s = time.time()-8*60*60 n = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(s)) print(n)
比如现在是2024-11-18 16:07:02,想要获取2024-11-18 08:07:02
2024-11-18 16:07:02
2024-11-18 08:07:02