函数datetime
datetime
import datetime.datetime
print(datetime.now()) #2019-03-20 11:35:25.(471359)毫秒 # 时间对象
f = datetime.timestamp(datetime.now()) # 将时间对象转换成时间戳 print(datetime.fromtimestamp(f)) # 将时间戳转成时间对象
print(datetime.strptime('2018-11-30','%Y-%m-%d')) # 将字符串转成时间对象
f = datetime.now() print(datetime.strftime(f,'%Y-%m-%d')) # 将时间对象转成字符串
from datetime import datetime,timedelta # 从xx导入 建议 print(datetime.now() - timedelta()) # 这个是datetime的精华