I have a time string defined as below:
default = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
I would like to replace the time portion alone with my defined time say 9:00:00
How would I be able accomplish this with datatime?
I have a time string defined as below:
default = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
I would like to replace the time portion alone with my defined time say 9:00:00
How would I be able accomplish this with datatime?
Using Replace:
datetime.datetime.now().replace(hour=23, minute=30).strftime('%Y-%m-%d %H:%M')