您好,欢迎来到化拓教育网。
搜索
您的当前位置:首页python自动化测试——时间戳转日期

python自动化测试——时间戳转日期

来源:化拓教育网
import datetime
#十位时间戳
timeStamp = 1568131200
otherStyleTime = datetime.datetime.utcfromtimestamp(timeStamp).strftime("%Y-%m-%d %H:%M:%S")
print(otherStyleTime)  #2019-09-10 16:00:00

import time
#十三位时间戳
timeStamp = 1568131200000
otherStyleTime = time.strftime('%Y-%m-%d %H:%M:%S',time.localtime(timeStamp/1000))
print(otherStyleTime) #2019-09-11 00:00:00

转载于:https://www.cnblogs.com/nicole-zhang/p/11498371.html

因篇幅问题不能全部显示,请点此查看更多更全内容

Copyright © 2019- huatuo9.cn 版权所有 赣ICP备2023008801号-1

违法及侵权请联系:TEL:199 18 7713 E-MAIL:2724546146@qq.com

本站由北京市万商天勤律师事务所王兴未律师提供法律服务