Adding Time

John Craig jc at spl21.net
Mon Oct 30 15:53:25 EST 2006


Same fields as before, but a different approach and less fussy.  Hope 
this gives some more ideas.

JC


on mouseUp
  if not matchText(fld "start", "^([[:digit:]]{1,2}):([[:digit:]]{1,2})[ 
]*([apm]{2})$", startHour, startMin, startPost) then
    answer "error with start time format"
    exit mouseUp
  end if
 
  if not matchText(fld "end", "^([[:digit:]]{1,2}):([[:digit:]]{1,2})[ 
]*([apm]{2})$", endHour, endMin, endPost) then
    answer "error with end time format"
    exit mouseUp
  end if

  if startPost = "pm" then add 12 to startHour
  if endPost = "pm" then add 12 to endHour
 
  put startHour * 60 + startMin into tSecs
  put endHour * 60 + endMin into endSecs
 
  put empty into fld "list"
 
  repeat while tSecs <= endSecs
    put trunc(tSecs / 60) into tHour
    if tHour > 12 then
      subtract 12 from tHour
      put "pm" into tPost
    else
      put "am" into tPost
    end if
    put tSecs mod 60 into tMins
    if fld "list" <> empty then put return after fld "list"
    put tHour & ":" & format("%02d", tMins) && tPost after fld "list"
    add fld "int" 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
>>
>>   
>
> _______________________________________________
> 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