时间转时间戳
import time
str_time="2010--03--24 20:47:31"
timeStamp=int(time.mktime(time.strptime(str_time,"%Y--%m--%d %H:%M:%S")))
print(timeStamp)
结果是1269434851
时间戳转时间字符串
timeStamp=1269434851
str_time=time.strftime("%Y--%m--%d %H:%M:%S", time.localtime(timeStamp))
print(str_time)
结果为2010–03–24 20:47:31
转载请注明原文地址:https://blackberry.8miu.com/read-34395.html