1、格式化时间time.strftime,返回字符串
import time
time.strftime('%Y-%m-%d %H:%M:%S')
2、时间差 timedelta
from datetime import datetime,timedelta
date_time = datetime.now()-timedelta(days=2)
date_time = date_time.strftime('%Y%m%d%H%M%S')
1、格式化时间time.strftime,返回字符串
import time
time.strftime('%Y-%m-%d %H:%M:%S')
2、时间差 timedelta
from datetime import datetime,timedelta
date_time = datetime.now()-timedelta(days=2)
date_time = date_time.strftime('%Y%m%d%H%M%S')