python-时间转换
# -*- coding: utf-8 -*- ''' Created on 2019年8月8日 ''' from datetime import datetime import datetime from time import strftime import time def toUnix(): tm=strftime("%Y-%m-%d %H:%M:%S") s = time.mktime(time.strptime(tm,'%Y-%m-%d %H:%M:%S')) s=str(s).split(".")[0]+"000" return s def tounix(tm): s = time.mktime(time.strptime(tm,'%Y-%m-%d %H:%M:%S')) s=str(s).split(".")[0]+"000" return s def add_tm(s): u"当前时间+s分钟" a= (datetime.datetime.now()+datetime.timedelta(minutes=s)).strftime("%Y-%m-%d %H:%M:%S") return a