I have a hidden view. One column is the completed time (COMPLETED) ; second column is the start time (START) and the third Column is the elapse time (ELAPSE). Depending on what the user enters in the completed and start times in the form. The elapse time column will calculate the COMPLETED and START time fields in “minutes”. Both these fields in the form use the date/time field with a custom of 24 hours. Unfortunately, the column of ELAPSE is giving me a negative number. This is the formula code that is used in the ELAPSE column:
elapsed :=@Round(COMPLETED - START)/60;
@Round(elapsed)
Example :
User selects COMPLETED time as 03:20
User selects START time as 19:20
Code for ELAPSE = -960
Subject: Calculation of Minutes
3:20 - 19:20 would be a negative value. In this case, you crossed midnight but didn’t take into account that you’ve changed dates.
You’ll need to include the date in your compution unless you can always know that the start and end times are on a single calendar date.
HTH
Doug
Subject: RE: Calculation of Minutes
Thanks for your response Doug. The fields on the form are editable time fields. So I believe the users are entering the time manually. Would that be the case?
Subject: RE: Calculation of Minutes
If you are SURE that your elapsed will never exceed more than one day, then you can check for a negative value, and just add 60*24 to it.
elapsed :=@Round(COMPLETED - START)/60;
elapsed2 :=@If(elapsed<0;elapsed+24*60,elapsed)
@Round(elapsed2)
If your event can take more than 24 hours, then your users need to specify the date that the events happened, as well as the time.
Subject: RE: Calculation of Minutes
Hi Graham,
Yes I am positive that the elapse time should not exceed more than one day.
I tested it out and it works perfectly! Thanks so much! Greatly Appreciated! 