python整小时 整天时间戳获取算法示例
作者:JNeuman 时间:2021-02-11 10:27:33
根据当前时间戳获得整小时时间戳
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
标签:python,小时,时间戳
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
Django学习笔记之Class-Based-View
2023-09-07 15:37:25
使用:after清除浮动
2008-10-30 12:10:00
Python实现定时任务
2022-06-12 04:53:31
python中is与双等于号“==”的区别示例详解
2023-07-09 22:40:19
设计师和美工
2008-10-27 13:43:00
![](https://img.aspxhome.com/file/UploadPic/200810/27/2008102713452199s.jpg)
使用Python的Flask框架构建大型Web应用程序的结构示例
2022-05-01 01:35:35
手把手带你用python爬取小姐姐私房照
2022-04-09 16:02:04
![](https://img.aspxhome.com/file/2023/0/92320_0s.jpg)
python3.9和pycharm的安装教程并创建简单项目的步骤
2021-06-18 05:34:16
![](https://img.aspxhome.com/file/2023/9/72189_0s.png)
Selenium自动化测试工具使用方法汇总
2022-02-10 16:26:21
Python3.5运算符操作实例详解
2021-06-09 11:41:17
![](https://img.aspxhome.com/file/2023/0/83900_0s.png)
使用python Django做网页
2023-11-22 03:35:26
![](https://img.aspxhome.com/file/2023/2/63892_0s.png)
python编程进阶之异常处理用法实例分析
2023-01-27 16:39:24
Python2.7:使用Pyhook模块监听鼠标键盘事件-获取坐标实例
2023-08-16 05:23:31
一文带你熟悉Go语言中函数的使用
2023-07-13 08:22:23
详解python中eval函数的作用
2022-06-03 07:46:31
python的PyPDF2实现pdf文件切割和合并
2023-02-07 19:57:39
![](https://img.aspxhome.com/file/2023/8/102968_0s.png)
使用 OpenCV-Python 识别答题卡判卷功能
2023-02-03 07:01:43
![](https://img.aspxhome.com/file/2023/5/87515_0s.jpg)
Python使用scrapy采集数据时为每个请求随机分配user-agent的方法
2023-02-08 15:20:31
Python中异常捕获与处理的方法总结
2023-12-10 07:48:24
![](https://img.aspxhome.com/file/2023/8/95898_0s.png)
数据库之:Mysql数据库服务器安装与配置
2010-08-31 14:11:00