get_time

def get_current_time():
#将python的datetime转换为unix时间戳
dtime = datetime.datetime.now()
un_time = time.mktime(dtime.timetuple())
#print un_time #1509636609.0
#将unix时间戳转换为python 的datetime
unix_ts = un_time
times = datetime.datetime.fromtimestamp(unix_ts)
#print times
return times #2017-11-02 23:29:45
上一篇:ionic cordova


下一篇:HTML5 自定义属性 data-* 和 jQuery.data 详解