replace
I know the accepted answer from four years ago works, but this seems a tad lighter than using replace
:
dt = datetime.date.today()
dt = datetime.datetime(dt.year, dt.month, dt.day)
Notes
datetime
object without passing time properties to the constructor, you get midnight.dt = datetime.datetime.now()