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

hh hh at hyperhh.de
Thu Oct 17 06:32:59 EDT 2019


Save a lot of lines by using "format":

on countdown t
  put format("%02d:%02d:%02d",t div 3600,(t mod 3600) div 60,t mod 60) into fld 1
  subtract 1 from t
  if t < 0 then exit countDown
  send "countdown t" to me in (1000-the millisecs mod 1000) millisecs
end countdown

> > Terry J. wrote:
> > 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
> 
> Klaus M. wrote:
> 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






More information about the use-livecode mailing list