Dealing with time format greater than 24 hours

I have data of experiments with time greater than 24 hours. For ex. [23:24:44, 25:10:44]. To operate duration of tests, I like to use Python, however I have a value error when I create datetime.time() with hours more than 23:59:.


You could split your time by the colons in order to get a list of the component parts, which you could then use to initialise your timedelta:

from datetime import timedelta

myDuration = "25:43:12"
mD = [int(x) for x in myDuration.split(":")]

delta = timedelta(hours=mD[0], minutes=mD[1], seconds=mD[2])
# 1 day, 1:43:12