根据当前时间戳获得整小时时间戳
unit = 3600 start_time = int(time.time())/3600 * 3600
根据当前时间戳获得整天时间戳
unit = 3600*24
start_time = int(time.time()) / unit * unit - 8 * 3600由于时间戳起始为1970 年 1 月 1 日(08:00:00)所以这里需要减8小时才时0点的时间戳
本文分享自 作者个人站点/博客 前往查看
如有侵权,请联系 cloudcommunity@tencent.com 删除。
本文参与 腾讯云自媒体分享计划 ,欢迎热爱写作的你一起参与!