时间戳→自1970年以来的秒计浮点数 【唯一值】
import time
t = time.time()
T = time.localtime(t)#tuple
print(time.strftime('%Y%m%d_%H%m%S',T)
>>> 20181107_091112
显示时间可以直接写成:
print(time.strftime('%Y%m%d %X',T)
>>> 20181107 09:15:12
时间戳→自1970年以来的秒计浮点数 【唯一值】
import time
t = time.time()
T = time.localtime(t)#tuple
print(time.strftime('%Y%m%d_%H%m%S',T)
>>> 20181107_091112
显示时间可以直接写成:
print(time.strftime('%Y%m%d %X',T)
>>> 20181107 09:15:12
本文标题:Python 时间戳和日期转换
本文链接:https://www.haomeiwen.com/subject/rzdmxqtx.html
网友评论