赞
踩
1、时间元组 --> 时间戳
import time
timeArray = time.localtime(time.time())
timeStamp = time.mktime(timeArray) # 时间戳:1600858387.0
2、时间元组 --> 字符串
timeDate = time.strftime("%Y-%m-%d %H:%M:%S", timeArray) # datetime.datetime:'2020-09-23 18:53:07'
timeDate = time.strftime("%Y-%m-%d", timeArray) # datetime.date:'2020-09-23'
想知道更多,请关注我的公众号~
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。