Skip to main content
Participant
February 18, 2020
Question

JavaScript for Calculating Average Time

  • February 18, 2020
  • 3 replies
  • 1585 views

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 has been closed for replies.

3 replies

Participant
February 18, 2020

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..

Participant
February 18, 2020

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

Thom Parker
Community Expert
Community Expert
February 18, 2020

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?

Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often
Participant
February 18, 2020

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

Participant
February 18, 2020
No - not yet. Still a newbie.
Thanks, Sasha