import time
str_time = '2013-10-10 23:40:00'
timestamp = int(time.mktime(time.strptime(str_time, '%Y-%m-%d %H:%M:%S'))) #转时间戳
data = time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(int(timestamp))) #转字符串
import time
str_time = '2013-10-10 23:40:00'
timestamp = int(time.mktime(time.strptime(str_time, '%Y-%m-%d %H:%M:%S'))) #转时间戳
data = time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(int(timestamp))) #转字符串
本文标题:python时间戳转换
本文链接:https://www.haomeiwen.com/subject/gdoqbttx.html
网友评论