115
编辑日期: 2024-11-28 文章阅读: 次
@author jackzhenguo
@desc
@date 2019/10/15
115 获取当前时间
from datetime import date, datetime
from time import localtime, strftime
today_date = date.today()
print(today_date) # 2019-12-22
today_time = datetime.today()
print(today_time) # 2019-12-22 18:02:33.398894
local_time = localtime()
print(strftime("%Y-%m-%d %H:%M:%S", local_time)) # 转化为定制的格式 2019-12-22 18:13:41