Copy link to clipboard
Copied
Seems simple? why does nothing show up in my duration feld, also set as HH:MM? I tried the simple script in computation for subtraction of one field from another. Nothing shows up.
Copy link to clipboard
Copied
Dates and times are complicated. There is no built-in functionality in Acrobat Forms for handling date/time with simple math and unfortunately there is nothing in the JS library for reducing data/time calcs to simple math either. To do this you just gotta write the code.
First, the date/time values in the form fields are not actual data/times, they are text representing a date/time. To perform a caculation they have to be converted to a Date Object. But, a time does not exist by itself. A time value is always on a day, so you have to provide a date and time together to create a date object. Then you can get the difference in miliseconds between the two dates, which you will then need to convert to text representation of the difference.
Here's are some articles on the topic.
https://acrobatusers.com/tutorials/date_time_part1/
https://acrobatusers.com/tutorials/date_time_part2/
https://www.pdfscripting.com/public/Date-and-Time-Handling.cfm
Copy link to clipboard
Copied
Too bad- it took me a few seconds to make such a set of fields in File
Maker. I mistakenly thought they had similar functionality!
Jill
(PII removed by moderator)
Copy link to clipboard
Copied
This issue was discussed here many times in the past, and complete code examples were given for it. And no, it's not a trivial thing to do. I recommend you try searching for similar topics first. If you can't find any, post again.