Skip to main content
Participant
December 11, 2019
Question

Adding Automatic Date to PDF that updates upon opening.

  • December 11, 2019
  • 6 replies
  • 69269 views

Hi, I need help with something. 

I am creating forms that need to be filled out. I am definitely not an expert and neither are the people that use my pdf's. Now I created all the files and placed text fields where needed and everything works as a charm. What is missing is: I need a small area called " Date: " To Autofill the correct date when a used opens the PDF. But only the user who fills it. Not the one opening it to read and respond. 

 

I managed to do it, but the date doesn’t update. It always gives me the original date I used.

 

Second problem. I live in Canada, and more specifically in Quebec. They have some computers who will write the date as: dd/mm/yy and others who use mm/dd/yy. And if you chose the wrong one for example yesterday I used 09/12/2019. And it wrote Sep, 12 2019. But on the other computer I wrote for the same file, 9 Dec 2019. (We are in December as I write this) Now I can’t control the way the computers are set some people French will use dd/mm/yy. The English operating systems use the mm/dd/yy.

 

What can I do?  

6 replies

Participant
September 10, 2025

How can I make PDF update the next few chronological dates in their field after I put in the first date manually?

 

Inspiring
December 11, 2019

See Example Acrobat JavaScripts for 2 examples of autopopulating populating a field with a date string. You want the item 3. Insert Today’s Date into Form Field. You will have to create a document level script action.

Inspiring
December 11, 2019

Lets look at each problem seperately.

What scripts did you use and where did you place the code for placing the auto entry date?

 

See Example Acrobat JavaScripts item 3. Run JavaScript on Document Open. It is more complex then you might need, but it will populate the date when the PDF is opened. Beaware that it will repopulate the date each time the PDF is opened. Additional code will be needed to prevent cheangint the date one it file has been opened and saved.

 

 

Participant
December 11, 2019

Como  ago para kel m devuelvan mi exceso de pago en infonavit del  a nombre de Esteban Hernandez Rivera

barbara_a7746676
Community Expert
Community Expert
December 11, 2019

Since you want the date to populate automatically, after adding the form field, in Text Field Properties in the General tab, turn on Read Only so that the user cannot change the date.

Next you'll need to create a document level script that is executed when the document is opened. If you don't see the JavaScript tool, click on More Tools in the list on the right and add it to your list of tools. Click the JavaScript tool. Then at the top of the screen, click Document JavaScripts. Give the script an appropriate name and click Add. Delete any text in the window and add this script:

var f = this.getField("Today");f.value = util.printd("mm/dd/yyyy", new Date());

The text in quotes should be the name of your form field, and it is case sensitive. In this example, the date field is named Today.

Click OK and Close.

To test that the form field is working correctly, Save the PDF, close it and then re-opoen it.

Participant
December 11, 2019

[Email address removed]

ls_rbls
Community Expert
Community Expert
December 11, 2019

Hi,

 

In edit mode, right-click on the date field, select Properties, and then the "Format" tab.

 

Then select from the pulldown menu that is right below the tab select "Date" and then "Custom".

 

In the blank provided below that selection type in the format that you want the date to be displayed like.

 

Click ok and you should be good to go.

 

Users won't have to type in a date anymore. A datepicker will provide the users of the form to select a date from a calendar pop up; the date will be displayed with the formatting that you've selected earlier.