I am aware that with the timedelta function you can convert seconds to h:m:s using something like:
>> import datetime
>> str(datetime.timedelta(seconds=666))
'0:11:06'
But I need to convert h:m:s to seconds, or minutes.
Do you know a function that can do this?
def hms_to_seconds(t):
h, m, s = [int(i) for i in t.split(':')]
return 3600*h + 60*m + s
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With