Time Formatting

Date: Thu, 25 Jan 1996 12:19:13 -0700
From: david@pacific.net (david smith)
Subject: scripts n tips: time formatting

formatTime

converts a variable containing "time" to a consistent-formatted string.
SCRIPT:
on formatTime t
  -- assumes t < 60 min and nonfractional seconds
  -- outputs time as MM:SS

  put string(integer (t/60)) into mins
  put string(t mod 60) into secs
  if the number of chars of mins = 1 then put "0" before mins
  if the number of chars of secs = 1 then put "0" before secs
  put mins & ":" & secs into tt
  return tt
end

EXAMPLE:
on stopwatch
     .
  put formatTime(T2 - T1) into field "countdownDisplay"
     .
     .
     .
end