【发布时间】:2020-10-22 15:20:46
【问题描述】:
我想在当前日期添加特定时间。 例如2020-10-22 12:00:00。 为此,我尝试了以下方式
from datetime import datetime, timedelta, date
duration = "12:00:00"
duration_obj = datetime.strptime(duration, '%H:%M:%S')
Date_Time = date.today() + duration_obj
但是,我遇到了错误
TypeError: unsupported operand type(s) for +: 'datetime.date' and 'datetime.datetime'
任何建议都会有所帮助....
【问题讨论】: