What is JotForm?
JotForm is a free online form builder which helps you create online forms without writing a single line of code. No sign-up required.
At JotForm, we want to make sure that you’re getting the online form builder help that you need. Our friendly customer support team is available 24/7.
We believe that if one user has a question, there could be more users who may have the same question. This is why many of our support forum threads are public and available to be searched and viewed. If you’d like help immediately, feel free to search for a similar question, or submit your question or concern.
Date time calculationAsked by labman3 on November 03, 2016 at 01:24 PM
I'm trying to calculate the number of hours worked on a completed work request. I used the calculations found in the forum, but it's not accurate. i.e. if i enter START time as: 11/2/2016 at 2:10pm and the END time as: 11/2/2016 at 9:30pm, the value returned is 7.33hrs, but it should be 7.2hrs.
Hello, the calculation is correct. In 1 hour, there's a total of 60 minutes, thus 6 iterations of 10-minute stepping.
The first 10 min mark is equivalent to 1/6, which is equal to 0.1666666666666667 (rounded off to .17). Then 2/6, 3/6 and so on.
Here's the complete breakdown of each 10 minute stepping:
10 mins = .17 (1/6)
20 mins = .33 (2/6)
30 mins = .5 (3/6)
40 mins = .67 4/6)
50 mins = .83 (5/6)
60 mins = 1 (6/6)
So, 9:30pm - 2:10pm = 7.33
If we'll convert .33 to minutes it will be:
2 / 6 = 0.3333333333333333
0.3333333333333333 * 60 = 20 mins
how would i calculate the so the time is 7hrs 20min?
Feature/option-wise, no there's no way to achieve that. But I'm currently looking for a workaround.
I can probably use Conditions to achieve something similar so allow me some time to come up with something. I'll get back to you on this same thread. :)
All right, can you check my test form: https://form.jotform.com/63077719135965
Here are all the things I did:
1. I hid your Hours form calculation and named it Hours (Temp).
2. I added 2 Textboxes (1 for Hours and 1 for Minutes)
3. I used the floor() function to round off the Hours (Temp) value then push the whole number to the Hours Textbox.
4. Then I setup the conditions for each of the results of the 10-minute stepping (.17 for 10 min, .33 for 20 mins, and so on).
You can also clone my form if you wanted to see how it was setup, here's how.
Let me know if that works for you :)
it works!! thank you very much.