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