2 Replies Latest reply on Mar 15, 2013 7:04 AM by BoydReilly

    Adding Time

    BoydReilly

      Title

      Adding Time

      Post


           I looked for a solution, but what I found was very old and didn't work for me.

            

           I have a field, StartTime, that is a time field.  A second field, Duration, is a calculation field.  The calculation field does this:

           Case ( Sport = "Boys Varsity Baseball" ; "2" ;
           Sport = "Boys Junior Varsity Baseball" ; "2" ;
           Sport = "Boys Middle School Baseball" ; "1.5"  )

            

           So, in the EndTime field I'd like to setup a calcualtion that will give me an ending time.  Say the sport is Boys Varsity Baseball and it starts at 1:00.  I'd like EndTime to calculate to 3:00.

            

           In the EndTime calculation I have this:

           Time(Mod(Hour(StartTime) + Duration;24); Minute(StartTime); Seconds(StartTime))

           I end up with a number in the EndTime field.

           Any idea why this isn't working?

           TIA.

           BR

        • 1. Re: Adding Time
          philmodjunk

               There's a simpler calculation that you can use. Time fields store their values as integers recording the number of seconds since midnight so we can add and subtract time so long as we add and subtract them in terms of seconds:

               StartTime + Duration * 3600

               will compute the end time. Just make sure to select "Time" and not "number" in the Result Type drop down in the lower left corner of the specify calculation dialog.

          • 2. Re: Adding Time
            BoydReilly

                 Awsome.

                 Thanks.