Adding Time
Eric Chatonet
eric.chatonet at sosmartsoftware.com
Mon Oct 30 16:15:47 EST 2006
Sorry, I did not use the right notation for function's arguments and
forgot to include error management:
on mouseUp
local tTimeList
-----
put BuildTimeList(fld "StartTime", fld "EndTime", fld "Interval")
into tTimeList
if tTimeList contains "error" then
-- error handling
else put tTimeList into fld "TimeList"
end mouseUp
--------------------------------------------
function BuildTimeList pStartime,pEndtime,pInterval
local tTimeList
-----
put pInterval * 60 into pInterval
convert pStartime from short time to seconds
convert pEndtime from short time to seconds
if pEndtime <= pStartime then return "Error: invalid time period"
-----
repeat until pStartime > pEndtime
convert pStartime from seconds to short time
put pStartime & cr after tTimeList
convert pStartime from short time to seconds
add pInterval to pStartime
end repeat
-----
delete char -1 of tTimeList
return tTimeList
end BuildTimeList
It assumes that "StartTime" and "EndTime" fields are formatted as
short English date and field "Interval" is an integer that means
minutes.
Le 30 oct. 06 à 22:00, Eric Chatonet a écrit :
> Hi jhonken,
>
> Here is another approach:
>
> on mouseUp
> put BuildTimeList(fld "StartTime", fld "EndTime", fld "Interval")
> into fld "TimeList"
> end mouseUp
> --------------------------------------------
> function BuildTimeList tStartime,tEndtime,tInterval
> local tTimeList
> -----
> put tInterval * 60 onto tInterval
> convert tStartime from short time to seconds
> convert tEndtime from short time to seconds
> -----
> repeat until tStartime > tEndtime
> convert tStartime from seconds to short time
> put tStartime & cr after tTimeList
> convert tStartime from short time to seconds
> add tInterval to tStartime
> end repeat
> -----
> delete char -1 of tTimeList
> return tTimeList
> end BuildTimeList
>
> It assumes that "StartTime" and "EndTime" fields are formatted as
> short English date and field "Interval" is an integer that means
> minutes.
>
> Best Regards from Paris,
> Eric Chatonet
>
> Le 30 oct. 06 à 20:27, jhonken a écrit :
>
>> 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.
>
>
> ----------------------------------------------------------------------
> ------------------------
> http://www.sosmartsoftware.com/ eric.chatonet at sosmartsoftware.com/
>
>
> _______________________________________________
> 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
>
Best Regards from Paris,
Eric Chatonet
------------------------------------------------------------------------
----------------------
http://www.sosmartsoftware.com/ eric.chatonet at sosmartsoftware.com/
More information about the use-livecode
mailing list