Skip to main content
kenwiseman123
Participant
August 8, 2016
Question

java script

  • August 8, 2016
  • 1 reply
  • 395 views

Hi,

i have problem applying javascript for a fillable document. does anyone know a javascript for applying the current  date and time.

So when i open the document, it will automatically show the current date and time.

Thank you.

This topic has been closed for replies.

1 reply

try67
Community Expert
Community Expert
August 8, 2016

Let's say you have a text field called Today. Go to Tools - JavaScript - Document JavaScripts and create a new item (let's call it MyScripts), with this code:

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

Click OK and save the file. From that moment on that field will contain the current time and date each time you open the file.

You can adjust the format of the date pattern string in the code to your liking, of course.

kenwiseman123
Participant
August 8, 2016

Thank you for your help kindly,

is it possible to do this on a javascript in acrobat x:

1) For time estimation, is it possible to designate mins, hours and the totals. so when i type in the time field. it will show the total time in hh/mm, when the current time commence.

2) For % can we make this a % field, so if we type in "90" it will show "90%"

Thank you!

try67
Community Expert
Community Expert
August 8, 2016

I don't understand how these questions relate to your original question... Please clarify what you mean.