JavaScript Clock (continuous)

Hello Thom, I hope you don't mind me asking this questions/advice. I followed your, "JavaScript Clock/Timer Demo", but cannot get the Continuous Clock to work. I would like to add a clock to my PDF so that it can record the time on the PDF document when someone submits it via e-mail using the action, mouse up, submit form feature. I am currently using Acrobat XI Pro. Thank you in advance.


Al Gonzalez


Voted Best Answer

It is not necessary to put a clock on your PDF to capture the time, The time is always available in the Acrobat JavaScript model. There are a few different ways you can add a "timestamp" to the submit. Here's an easy one.

  1. Add a text field to your form named "SubmitTime", this field may be hidden so the user can't see it.
  2. Add a "Run a JavaScript" action to the mouseup event on the submit button. This action must be before the submit action.
  3. put this code in the button

    this.getField("SubmitTime").value = util.printd("mm/dd/yyyy HH:mm:ss",new Date());

The current date and time will now be submitted with the form data.


Thom Parker
The source for PDF Scripting Info pdfscripting.com
All About PDF Stamps in Acrobat and Paperless Workflows - THE BOOK !!

The Acrobat JavaScript Reference, Use it Early and Often

The most important JavaScript Development tool in Acrobat
The Console Window (Video tutorial)
The Console Window(article)

Having trouble, Why Doesn't my Script Work


By Thom Parker   


Please specify a reason: