seconds to standard time numberformat?

Jan Schenkel janschenkel at yahoo.com
Sat Aug 23 00:31:00 EDT 2003


--- Monte Goulding <monte at sweattechnologies.com>
wrote:
> 
> 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.

=====
"As we grow older, we grow both wiser and more foolish at the same time."  (La Rochefoucauld)

__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com



More information about the use-livecode mailing list