I have been developing some tools for the media production lately, i found a neat way to add or subtract certain amount of seconds to a given time code.
for example i have a video that starts from 12:45:05 and i want to add 59 seconds to it and use the new time.
from datetime import datetime from datetime import timedelta time = datetime(2009, 1, 1, 12, 45, 05, 0) diff = timedelta(seconds = 59) final_time = time + diff