>>> import time
>>> time.time()
1551074262.4575639
>>> st = time.strptime('2019-02-25 13:08:20', '%Y-%m-%d %H:%M:%S')
>>> time.mktime(st)
1551071300.0
>>> time.strftime('%Y-%m-%d %H:%M:%S', time.localtime())
'2019-02-25 13:59:45'
>>> import time
>>> time.time()
1551074262.4575639
>>> st = time.strptime('2019-02-25 13:08:20', '%Y-%m-%d %H:%M:%S')
>>> time.mktime(st)
1551071300.0
>>> time.strftime('%Y-%m-%d %H:%M:%S', time.localtime())
'2019-02-25 13:59:45'
本文标题:Python时间戳与格式化日期相互转换
本文链接:https://www.haomeiwen.com/subject/xdzwyqtx.html
网友评论