
Format Seconds (HH:MM:SS)
A routine to convert seconds to hh:mm:ss (hours:minutes:seconds).
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
on FormatSeconds(totalSeconds) set theHours to (totalSeconds div hours) set theRemainderSeconds to (totalSeconds mod hours) set theMinutes to (theRemainderSeconds div minutes) set theRemainderSeconds to (theRemainderSeconds mod minutes) if length of (theHours as text) = 1 then set theHours to "0" & (theHours as text) end if if length of (theMinutes as text) = 1 then set theMinutes to "0" & (theMinutes as text) end if if length of (theRemainderSeconds as text) = 1 then set theRemainderSeconds to "0" & (theRemainderSeconds as text) end if set theTimeString to theHours & ":" & theMinutes & ":" & theRemainderSeconds as text return theTimeString end FormatSeconds |