[EMAIL PROTECTED] wrote:
> 
> On Fri, 12 Nov 99, Leston Drake wrote:
> 
> > Hi all,
> >
> > I've got a "countdown" clock in my app that shows time remaining. For example,
> > I want to have it start at "5:00" (five minutes) and count down to "0:00". The
> > formatting is important so that it reads correctly. I am using the send command
> > to update it every second and to let me know when it's finished. To do this, I
> > am using the seconds() function.
> >
> > My question is this: Once I compute the seconds remaining, how do I convert it
> > to a "MM:SS" format?

Play with this.  The convert function is very useful for date
calculations also.  First convert to seconds, add/subtract seconds,
then convert back to date.


on mouseUp
  put 300 into x
  --
  convert x to  dateitems
  put x into fld 1
  put item 5 of x&":"&item 6 of x into y
  put y into fld 2  -- but seconds won't have leading zero
  convert x to long time --gives hours and AM/PM
  delete  last word of x --delete AM/PM
  set itemdelimiter to ":"
  delete item 1 of x  --delete hours
  put x into fld 3
end mouseUp
-- 
Steven D. Tripp +-------------------------------------------+ 
University of Aizu |+-----------------------------------------+| 
Aizu-Wakamatsu, Japan || Lat 39.5 N Long 140 E GMT +9 || 
[EMAIL PROTECTED] |+-----------------------------------------+| 
fax +81-242-37-2599 +-------------------------------------------+ 
USA efax (810) 821-5054+--------------------------------------------+ 
------------------------------------------------------------------

Reply via email to