datetime.timedelta is for fixed time differences (for example, 1 day is fixed, 1 month is not).
>>> import datetime >>> t = datetime.time(13, 5) >>> print t 13:05:00 >>> now = datetime.datetime.now() >>> print now 2009-11-17 13:03:02.227375 >>> print now + datetime.timedelta(hours=1, minutes=23, seconds=10) 2009-11-17 14:26:12.227375
Note that it doesn't make sense to do the addition in one go (but you can combine the date and time into a datetime object, use this, and then get the time). DST is the main culprit. For example, 12:01 am + 5 hours may be 4:01 am, 5:01 am, or 6:01 am on different days.
Roger Pate
source share