3 Replies Latest reply on Dec 18, 2014 3:14 PM by philmodjunk

    Time Calculation

    MattSantana

      Title

      Time Calculation

      Post

      New to Filemaker and looking for some basic help with time calculation.

      I have a STARTIME and ENDTIME fields. When I put the calculation STARTIME - ENDTIME in the 3rd TOTALHOURS field, looks like this 5:00:00. How to I get it to show 5 rather than 5:00:00.

        • 1. Re: Time Calculation
          philmodjunk

          Don't you really have EndTime - StartTime?

          What you show is what you get when you select time as the result type.

          Use ( EndTime - StartTime ) / 3600 and select Number as the result type. (There are 3600 seconds in an hour)

          You can also use time data formatting on your current field to show only the hours.

          • 2. Re: Time Calculation
            MattSantana

            Gotcha... ok. Made that change and now I've got this showing   -4. 

            START TIME 10:00AM

            END TIME 2:00PM

            How to I remove the Negative - ?

             

            • 3. Re: Time Calculation
              philmodjunk

              It shouldn't be negative. 2 pm is greater than 10 am so subtracting Start Time from End Time should not produce a negative.

              EndTime - StartTime is 14400 seconds

              (EndTime - StartTime ) / 3600 is 4 hours

              No negative should be produced in either case. As I pointed out in my last post, you have the terms reversed and are subtracting the larger value (End Time) from the smaller (start time).

              (But beware of time intervals that start before midnight and end after midnight. If those are possible, you should use TimeStamp values instead of time.)

              it may help to point out that time fields store time as an integer equal to the number of seconds since midnight regardless of whether you use a 12 hour or 24 hour format.