python时间戳转时间格式

一、两种时间戳转换为时间格式:13位和10位,将时间戳转成时间格式

复制代码
import time

#13位时间戳转时间
tre_timeArray = time.localtime(1646012206685/1000)
tre_otherStyleTime = time.strftime("%Y-%m-%d %H:%M:%S", tre_timeArray)
print('tre_otherStyleTime',tre_otherStyleTime)

#10位时间戳转时间
ten_timeArray = time.localtime(1632651709)
ten_otherStyleTime = time.strftime("%Y-%m-%d %H:%M:%S", ten_timeArray)
print('ten_otherStyleTime',ten_otherStyleTime)
复制代码

 

 

二、生成时间戳的写法

 

posted @   何双新  阅读(13256)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 无需6万激活码!GitHub神秘组织3小时极速复刻Manus,手把手教你使用OpenManus搭建本
· C#/.NET/.NET Core优秀项目和框架2025年2月简报
· Manus爆火,是硬核还是营销?
· 一文读懂知识蒸馏
· 终于写完轮子一部分:tcp代理 了,记录一下
历史上的今天:
2021-05-30 CSS样式实现表头和列固定
2017-05-30 odoo销售转生产
点击右上角即可分享
微信分享提示