Calculating duration from start & finish times

PaulT

Member
I am trying to create a job time-sheet, is it possible to have within a day group such as Monday (Group) a Start (Element) Finish (Element) and Time Off (Element) which enters the total time into a Total Hours (Element)?
The Start entered as 9:00 am for example and Finish entered as 5:00 pm. The Time off entered as 00:30 for example using a Time plugin representing 30 mins. The duration would be calculated from the Start and Finish times and then the Time off would be subtracted from that duration and that would be the Total Hours.
 
You could use the calc element to do that.

If you search the forums for suitable terms, you will find a lot of questions and answers about date calculations.

-- hugh
 
I accomplish this using the suggestion Hugh mentions, use the Calc element to calculate the date elements. Update the date elements accordingly to capture dates to calculate.
 
I accomplish this using the suggestion Hugh mentions, use the Calc element to calculate the date elements. Update the date elements accordingly to capture dates to calculate.
Can you show me an example of the calculation you entered please?
 
JavaScript:
$progress = '{tab___calcinprogresstoclosed}';
$closed = '{tab___calcnewtoclosed}';
$datediffy = ($closed - $progress);
return $datediffy;
 
JavaScript:
$progress = '{tab___calcinprogresstoclosed}';
$closed = '{tab___calcnewtoclosed}';
$datediffy = ($closed - $progress);
return $datediffy;

This worked except it only calculated the hours difference not the minutes. Is there a way to calculate the difference between 2 time fields that are formatted H:i and return in format H:i?
 
I solved this for my purposes anyway. Instead of using a Time element for start and finish input I changed it to a dropdown element that has a list of times in 15 min increments for the labels and I set the values to text. Now the calculation is much easier and I was also able to add a time off for breaks element which I added into the calculation. The result is a total of hours for that job on that day in digital format not time. i.e. 1.5 hours rather than 1:30. I am sure there are ways to do this with time formats but after a week of searching and failing this method works for me. As I have noticed on this forum there is always more than one way to do anything.
 
Last edited:
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top