下面介绍python获得时间戳的方法:
(1)10时间戳获取方法:
>>> import time
>>> t = time.time()
>>> print(t)
>>> print (int(t))
(2)13位时间戳获取方法:
2.1默认情况下python的时间戳是以秒为单位输出的float
>>> import time
>>> time.time()
通过把秒转换毫秒的方法获得13位的时间戳:
import time
millis = int(round(time.time() * 1000))
2.2 方法二 current_milli_time()必须加括号
import time
current_milli_time()
(3)13位时间戳转换成时间:
>>> import time
>>> now = int(round(time.time()*1000))
>>> now02
&39;