Is there a command to display number of seconds as hrs:min:seconds?

Klaus major-k klaus at major-k.de
Thu Oct 17 05:50:33 EDT 2019


Hi all,

> Am 17.10.2019 um 02:41 schrieb Terry Judd via use-livecode <use-livecode at lists.runrev.com>:
> 
> Not built-in but...
> 
> function formatRemainingTime pTime
>   put trunc(pTime/3600) into tHours
>   put pTime mod 3600 into tTimeX
>   put trunc(tTimeX/60) into tMins
>   put tTimeX mod 60 into tSecs
>   if tHours < 10 then put "0" before tHours
>   if tMins < 10 then put "0" before tMins
>   if tSecs < 10 then put "0" before tSecs
>   return tHours&":"&tMins&":"&tSecs
> end formatRemainingTime

save some lines by setting the numberformat first (lazy moi :-)

function formatRemainingTime pTime
   set the numberformat to "xx"
   put trunc(pTime/3600) into tHours
   put pTime mod 3600 into tTimeX
   put trunc(tTimeX/60) into tMins
   put tTimeX mod 60 into tSecs
   return tHours&":"&tMins&":"&tSecs
end formatRemainingTime


Best

Klaus

--
Klaus Major
https://www.major-k.de
klaus at major-k.de





More information about the use-livecode mailing list