How to add a datetime.timedelta object to a datetime.time in Python

Adding a datetime.timedelta object to a datetime.time results in a new datetime.time object. For example, adding 1:05:25 to 13:40:10 results in 14:45:35.

Solution for How to add a datetime.timedelta object to a datetime.time in Python : You can use datetime.datetime.combine() to add a datetime.timedelta object to a datetime.time Call datetime.datetime.combine(date, time) with date as any datetime.date object and time as the datetime.time object to create a datetime.datetime object. Use + to add the datetime.timedelta object to the previous result. Call datetime.datetime.time() to get a datetime.time object frome the previous result datetime.datetime.


how-to-add-a-datetime-timedelta-object-to-a-datetime-time-in-python