Python time + timedelta equivalent

python

I'm trying to do something like this:

time() + timedelta(hours=1)

however, Python doesn't allow it, apparently for good reason.

Does anyone have a simple work around?

Related:

Best Solution

The solution is in the link that you provided in your question:

datetime.combine(date.today(), time()) + timedelta(hours=1)

Full example:

from datetime import date, datetime, time, timedelta

dt = datetime.combine(date.today(), time(23, 55)) + timedelta(minutes=30)
print dt.time()

Output:

00:25:00