python 获取今天凌晨时间戳
2020-03-31 python 1868
import time,datetime def date2time(t): timeArray = time.strptime(t, "%Y-%m-%d %H:%M:%S") # 转换成时间戳 return int(time.mktime(timeArray)) def todaytime(): return int(time.mktime(datetime.date.today().timetuple())) t = "2020-03-18 10:31:02" timeArray = time.strptime(t, "%Y-%m-%d %H:%M:%S") #转换成时间戳 timestamp = int(time.mktime(timeArray)) print(timestamp) #获取今天凌晨时间戳 day_time=int(time.mktime(datetime.date.today().timetuple())) print(day_time)
很赞哦! (0)
相关文章
文章评论
-
-
-
0条评论