Click here to Skip to main content
15,884,237 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am working on an adobe form that we capture the start and end time, as well as breaks. I am looking for a java script that I can take the end time number and subtract the start time number then minus out the breaks and calculate hours worked. For instance, Start 07:00 end time 19:00 1 break (this would be an hour. .5 would be a half hour) so ((19:00-7:00)-1)=11.

Has anyone done this before?

What I have tried:

I have tried to work with the simple format features in adobe, however it will only add or multiple. No subtraction. or at least if it does I can not figure it out.
Posted
Updated 7-Mar-23 18:55pm

1 solution

Convert the times to a minutes count: 07:00 becomes 7 * 60 + 0 == 420, 19:30 becomes 19 * 60 + 30 == 1170
Then the difference is trivial math: 1170 - 420 == 750 and you can work that back to hours and minutes with integer division and modulus.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900