How Transform Days To Hours, Minutes And Seconds In Python
I have value 1 day, 14:44:00 which I would like transform into this: 38:44:00. I've tried the following code: myTime = ((myTime.days*24+myTime.hours), myTime.minutes, myTime.second
Solution 1:
The timedelta object doesn't have hours property. Only microseconds
, seconds
and days
.
Use:
myTime = '%02d:%02d:%02d.%06d' % (myTime.days*24 + myTime.seconds // 3600, (myTime.seconds % 3600) // 60, myTime.seconds % 60, myTime.microseconds)
Post a Comment for "How Transform Days To Hours, Minutes And Seconds In Python"