Copy link to clipboard
Copied
Hi,
I'm trying to add a calculation into a form field to calculate the time worked (based on start and finish time) less break time:
09:00 17:00 1:00 (time worked would be 7 hours)
22:00 04:00 1:00 (time worked would be 5 hours)
I've tried to follow other forums posted for similar things, however my Adobe calculation skills aren't very advanced! If this were excel I'd be fine.
If someone could provide a custom validation script, I'd be extremely grateful!
Thanks
Copy link to clipboard
Copied
[I've moved your question to the JavaScript forum]
Time calculations are not simple, but have been discussed on these forums many times. I suggest you try searching for them and I'll sure you'll find some good answers, including code samples. Keep in mind that what you need is a calculation script, not a validation one, though.
If you wish to learn how to work with the Date object in Acrobat, these tutorials offer an excellent starting point:
https://acrobatusers.com/tutorials/working-with-date-and-time-in-acrobat-javascript
https://acrobatusers.com/tutorials/working-with-date-and-time-in-acrobat-javascript-part-2
https://acrobatusers.com/tutorials/working-with-date-and-time-in-acrobat-javascript-part-3
In addition, I've developed a (paid-for) tool that allows you to easily set up this kind of calculation.
You can find it here: Custom-made Adobe Scripts: Acrobat -- Calculate Time Differences in a Worksheet