网络编程
位置:首页>> 网络编程>> Python编程>> python整小时 整天时间戳获取算法示例

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

作者:JNeuman  发布时间:2021-02-11 10:27:33 

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

来源:https://blog.csdn.net/wangxin6722513/article/details/78564068

0
投稿

猜你喜欢

手机版 网络编程 asp之家 www.aspxhome.com