当前位置:主页 > 软件编程 > Python代码 >

python整小时 整天时间戳获取算法示例

时间:2021-09-02 10:06:45 | 栏目:Python代码 | 点击:

根据当前时间戳获得整小时时间戳

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点的时间戳

您可能感兴趣的文章:

相关文章