Adding Time
John Craig
jc at spl21.net
Mon Oct 30 15:26:05 EST 2006
Here's a quickie that seems to work OK with windoze + 2.7.4
4 fields - start, end, int and list - populated with '8:00 am', '5:00
pm', '5' and empty.
It's quite fussy - doesn't like it if I miss the space before am, etc.
Hopefully this will give you some ideas.
JC
on mouseUp
put fld "start" into tStart
put fld "end" into tEnd
put fld "int" into tInterval
put empty into fld "list"
convert tStart to dateItems
convert tEnd to dateItems
put item 4 of tStart * 60 + item 5 of tStart into tStartSecs
put item 4 of tEnd * 60 + item 5 of tEnd into tEndSecs
put tStartSecs into tSecs
repeat while tSecs <= tEndSecs
put tSecs into tTime
convert tTime from seconds to dateItems
put item 5 of tTime into tHour
put item 6 of tTime into tMin
if tHour > 12 then
subtract 12 from tHour
put "pm" into tPost
else
put "am" into tPost
end if
if fld "list" <> empty then put return after fld "list"
put tHour & ":" & format("%02d", tMin) && tPost after fld "list"
add tInterval to tSecs
end repeat
end mouseUp
jhonken wrote:
> Can anyone steer me in the correct direction for this? What I need to
> do 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.
> etc.
> 5:00 P.M.
>
> Any help would be greatly appreciated.
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution
>
>
More information about the use-livecode
mailing list