Re Subject: Adding Time

Jim Ault JimAultWins at
Mon Oct 30 22:15:06 EST 2006

>   Regarding >
>> Can anyone steer me in the correct direction for this?  What I need to
>> o is populate a list box with times at specific intervals.  i.e.
>> I have a input box for the start time say 8:00 A.M.
>> I have a input box that has a stop time say 5:00 P.M.
>> I have a input box that has an interval say 5 minutes.
>> What I want to do is populate a list box with:
>> 8:00 A.M.
>> 8:05 A.M.
>> 8:10 A.M.
>> etc.
>> etc.

on createTimeList
  get the short date
  convert it to long time
  --now correct for Rev's ability to return 1 AM or 2 AM
  put char 1 of it into theHour
  convert it to seconds
  put (it - 60*60*theHour) into midnight
  --now we have a value for last midnight in seconds
  put empty into fld timeList  --destination for our list
  put 5 into incrementMinutes --****************
  put 60/incrementMinutes into intervalsPerHour
  put (60*60)/intervalsPerHour into secsPerInterval
  set the twelvehourtime to true --optional, if needing 13:05 to be 1:05 PM
  repeat with x = 0 to  (24*intervalsPerHour-1)
    put midnight+(x*secsPerInterval) into secsOfThisDay
    get secsOfThisDay
    convert it to short time
    put it & cr after fld timeList
  end repeat
  delete last char of fld timeList
end createTimeList

--You can edit the list as you wish
--change the line "put 5 into incrementMinutes"

Hope this helps

Jim Ault
Las Vegas

More information about the use-livecode mailing list