Skip to main content
abes63862432
Participant
July 10, 2016
Question

todays date in acrobat

  • July 10, 2016
  • 2 replies
  • 1385 views

I would like to create a form that when printed the date it is printed appears on the top of the form. I have found the following;

In brief:
1. Add form field with the read only property and hidden but printable general options.
2. Add a JavaScript tot the Will Print document action.

this.getField("PrintDateFieldName").value = "Printed on: " +util.printd("mmm d, yyyy", new Date()) + " at " + util.printd("h:MM tt", new Date());

You need to change the field name to your field name and the format of the date and time to the style you want.

Working with date and time in Acrobat JavaScript - Part 2 by Thom Parker

The problem I have having with these instructions are the following; when I go to Add the JavaScript a box appears to add javascript and when you put in the javascript the two options you have is "cancel" or "Go to" and you have to choose a line in the ?document? or ?editor? . All the instructions I can find regarding this all say to add the javascript and hit close or OK but neither is an option when adding new javascript. Any advice?

Look at similar directions below. I know I am a novice...please be gentle with me  

10down voteaccepted

Remove your script and replace it with the following document javascript:

var f = this.getField("wells_datefield");

if (!f.value) f.value = util.printd ("m/d/yyyy", new Date());

Save your form and open it, and the date should pop right in there.

When making the document javascript, remember to not put it inside a function. One way of doing that is the following. In the Acrobat menu:

  1. Advanced->Document Processing->Document Javascripts...
  2. In the dialog that pops up, enter a Script Name (for instance "populate_date") and click Add...
  3. In the script dialog that pops up: REMOVE everything ("function populate_date(){}") and paste in the script above.
  4. Click ok, then Close.
  5. Save the form, close it and reopen it.
  6. There is no step 6! 😆

This topic has been closed for replies.

2 replies

Inspiring
July 10, 2016

Can you post a screen shot of the dialog that you think should have the OK button?

abes63862432
Participant
July 10, 2016

abes63862432
Participant
July 10, 2016

OMG!!!! That is just too funny!!!!

I've been spending hours....and just plucked out the last hair on my

head....Thank you!!!


Further follow up question.

I got this functioning. But...what I would like to accomplish is that this form is available for various people to access, When they go to print it out then the date and time automatically update and print out with the date/time that the form is printed. Currently this has a stagnant date time that is reflective of when I created the form.

try67
Community Expert
Community Expert
July 10, 2016

What version of Acrobat do you have?

abes63862432
Participant
July 10, 2016

Acrobat DC Version 2015.016.20045

I am a subscriber to creative cloud.