Q:

How to read a text as today's time in python?

When I try to convert a string that contains some time in the format of 13:00, it is keeping the date field as 1900-01-01 13:00:00.
But I want to keep today's' date there.
import datetime as dt
sTime = "13:00"
sTime = dt.datetime.strptime(sTime, '%H:%M')

Any suggestions?

A:

Use combine:
import datetime as dt

sTime = "13:00"
sTime = dt.datetime.strptime(sTime, '%H:%M')
print(dt.datetime.combine(dt.datetime.today(), sTime.time()))

outputs
2020-08-28 13:00:00

Or directly but with a bit more work:
import datetime as dt

sTime = "13:00"
sTime = dt.datetime.strptime(sTime, '%H:%M')
today = dt.datetime.today()
print(dt.datetime(today.year, today.month, today.day, sTime.hour, sTime.minute, sTime.second))

