时间戳转化为时间
import time
def time_fun(x):
timeArray = time.localtime(x)
otherStyleTime = time.strftime("%Y-%m-%d %H:%M:%S", timeArray)
return otherStyleTime
time_fun(1634079063)#10位时间戳
#'2021-10-13 06:51:03'
time_fun(1567412375458/1000)#13位时间戳需要除以1000
#'2019-09-02 16:19:35'
获取当前时间戳
int(time.time())#获取当前10位时间戳
int(round(time.time() * 1000))#获取当前13位时间戳