python time + timedelta equivalent

python

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

Problem

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: - What is the standard way to add N seconds to datetime.time in Python?

Original source

Related problems