Skip to main content
Participant
Feb 18, 2020 7:15 PM UTC
Question

JavaScript for Calculating Average Time

I am trying to create a custom calculation script that will calculate an average using the HH:MM:ss format in a fillable PDF. The form has 12 fields to enter a time in the HH:MM:ss format, and I need to create a field that will average those 12 fields, and omit the fields that have nothing entered. I am familiar with javascript, but have never written. Can someone please help?

 

Thanks in advance!

This topic is closed to new replies. Start a new post to keep the conversation going.

6 replies

Participant
Feb 18, 2020 11:15 PM UTC

These are good snipped of code to get date time average, specially if you need to calculate time between a range of dates... the article has code snipped for both, averaging time within a day or different dates. But be aware that not all JavaScript functions will work as expected in Acrobat JS so might take some research..

Translate
Participant
Feb 18, 2020 7:39 PM UTC

This article might not be specifically about what you are looking for but the functions used might be a good start.

Translate
Thom Parker
Community Expert
Community Expert
Feb 18, 2020 7:35 PM UTC

Are you interested in learning JavaScript? Would you like some direction on how to start on a solution? Or do you just want someone to write the script for you?

Translate
Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often
Participant
Feb 18, 2020 8:10 PM UTC

Either, honestly! I am interested in learning in the long run, but I need to turn this project over rather quickly.

Translate
Participant
Feb 18, 2020 8:15 PM UTC
No - not yet. Still a newbie.
Thanks, Sasha
Translate