# 将时间变成时间戳
def tranftimestamp(stringtime):
try:
return time.mktime(time.strptime(stringtime, "%Y-%m-%d %H:%M:%S.%f"))
except:
return time.mktime(time.strptime(stringtime, "%Y-%m-%d %H:%M:%S"))
# 将时间戳转化为时间
def tranftime(timestamp):
return time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(timestamp))