seconds to standard time numberformat?

Monte Goulding monte at sweattechnologies.com
Sat Aug 23 20:15:05 EDT 2003


> >
> > Hi
> >
> > You've had quite a number of solutions but here's
> > another one:
> >
> > -- function to return the the time format (h:mm:ss)
> > from an input in seconds
> > function timeFormat timeInSecs
> >   if timeInSecs = 0 then
> >     put "0:00:00" into timeInForm
> >   else
> >     put format("%1d:%2d:%2d", timeInSecs div 60 div
> > 60, timeInSecs div 60
> > mod 60, timeInSecs mod 60) into timeInForm
> >     repeat with x = 1 to the number of chars of
> > timeInForm
> >       if char X of timeInForm is space then
> >         put 0 into char X of timeInForm
> >       end if
> >     end repeat
> >   end if
> >   return timeInForm
> > end timeFormat
> >
> > Cheers
> >
> > Monte
> >
>
> You can shave off a few lines by replacing the "repeat
> with X = 1 to ..." - loop with
>   replace space with "0" in timeInForm
> But I think our fellow listee has many, many options
> to choose from now :-)
>
> Jan Schenkel.

Thanks Jan

That's one I wrote in my early days with MC and haven't looked at since
because it works. Will make the change though ;-)

Cheers

Monte




More information about the use-livecode mailing list