Re Subject: Adding Time

2006-10-30 Thread Dave Herndon
  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.
The script below worked for me.  It returns the format below for a 24 hour 
period at 15 min intervals.  I had to do some minor editing to it to get 
perfect before I inserted it as the contents of a button.  I'm not proud of the 
script but it got the job done for me.  If you need the script that compares 
the difference between two of these numbers and compares them against a 24 hour 
period let me know.  Comparing say 0800 and 1315 and returning 5.25 Hrs.  I am 
a Firefighter and we work 24 hour shiftso I use the script often.
  script returns...
  
  0015
  0030
  0045
  0100
  0100
  0115
  0130
  0145
  0200
  0200
  0215
  up to 2400 hrs
   
  on mouseUp
  put 0 into daTime
  put  into line 1 of field hr select
  repeat with x = 2 to 119
  put daTime + 15 into DaTime
  if DaTime is 60 then
  put 100 into daTime
  put DaTime into line x of field hr Select
  add 1 to x
  put tab  DaTime into line x of field hr Select
  next repeat
  end if
  if the number of chars of daTime  4 then
  if char 2 to 4 of DaTime is 60 then
  put 00 into char 2 to 4 of DaTime
  put char 1 of daTime + 1 into char 1 of daTime
  end if
  else
  if char 3 to 5 of DaTime is 60 then
  put 00 into char 3 to 5 of DaTime
  if char 2 of daTime is 9 then
  put 2000 into daTime
  put DaTime into line x of field hr Select
  add 1 to x
  put tab  DaTime into line x of field hr Select
  next repeat
  end if
  put char 2 of daTime + 1 into char 2 of daTime
  end if
  end if
  if the number of chars of daTime  2 then
  if char 2 to 3 of DaTime is 00 then
  put DaTime into line x of field hr Select
  add 1 to x
  put tab  DaTime into line x of field hr Select
  next repeat
  end if
  end if
  if the number of chars of daTime  3 then
  if char 3 to 4 of DaTime is 00 then
  put DaTime into line x of field hr Select
  add 1 to x
  put tab  DaTime into line x of field hr Select
  next repeat
  end if
  end if
  put tab  DaTime into line x of field hr Select  puts all the times 
into a field called hr select
  end repeat
  end mouseUp
___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: Re Subject: Adding Time

2006-10-30 Thread Jim Ault


   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


___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution