Convert a number of seconds into a human readable time string HH:MM:SS
7046 seconds is: 1 hour 57 mins 26 secs, or 01:57:26
The Function:
def humanize_time(secs): mins, secs = divmod(secs, 60) hours, mins = divmod(mins, 60) return '%02d:%02d:%02d' % (hours, mins, secs)
The Output:
print humanize_time(7046)>> 01:57:26
Copyright © 2006-2008 Corey Goldberg
Disclaimer The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.