How to Automatically Insert Today's Date in an Acrobat PDF Form
Question details
The user wants a date field in a PDF form to automatically populate with the current date whenever the document is opened.

- Product
- Adobe Acrobat
- Device & OS
- not provided
- Scenario
- Preparing a PDF form for distribution or signature collection where the current date must be auto-filled to save time and ensure accuracy.
- Observed behavior
- The date field requires automation so it displays today's date automatically without requiring manual user input upon opening the file.
Ensure you have Adobe Acrobat Pro DC or Standard installed, as the free Adobe Acrobat Reader cannot author or embed document-level JavaScript into PDF forms.
Use Document-Level JavaScript in Acrobat Pro
The most effective way to auto-populate a date field is by applying a short JavaScript snippet that executes as soon as the PDF is opened.
By utilizing document-level JavaScript, you can instruct the PDF to read the current system date and inject it into a specific read-only text field. This ensures the date is always accurate at the moment of opening.
Open your PDF in Acrobat Pro. Go to 'Prepare Form', add a new Text field, and name it exactly 'currentDate'. Open the field's Properties, and under the 'General' tab, check the box for 'Read Only' so users cannot manually alter it.
Navigate to the 'Tools' view in Acrobat DC. Locate the 'JavaScript' tool (you can search for it if it is not immediately visible) and click to open it.
In the JavaScript toolbar, click on 'Document JavaScripts'. In the dialog box that appears, type a name for your script (e.g., 'AutoDate') and click the 'Add' button.
Delete any default code in the editor window and paste the following snippet: `var dateToday = util.printd("mmmm dd, yyyy", new Date()); this.getField("currentDate").value = dateToday;`. Click 'OK', then close the dialog and save your PDF.

Easily Edit and Manage PDF Forms with WPS Office
If you want to avoid complex JavaScript coding or simply need an easier way to manage, edit, and fill out PDF forms, WPS Office provides an intuitive and powerful PDF editor.
- 1. Open your PDF in WPS Office: Launch WPS Office and open your PDF form using the built-in WPS PDF tool.
- 2. Access the Form or Edit tab: Navigate to the 'Edit' or 'Form' tab at the top of the interface to access all PDF modification tools.
- 3. Insert Date or Fill Form: Use the 'Add Text' tool to quickly stamp today's date, or utilize the interactive form filler to complete your document effortlessly.

Frequently Asked Questions
Why doesn't the date update automatically when I open the PDF?
If the script isn't running, ensure that JavaScript is enabled in your Acrobat settings (Edit > Preferences > JavaScript). Also, verify that the text field is named exactly 'currentDate' (case-sensitive) and that the script was saved as a Document-level script, not a field calculation script.
Can I change the format of the auto-inserted date?
Yes. In the JavaScript code `util.printd("mmmm dd, yyyy", new Date())`, you can modify the format string. For example, use "mm/dd/yyyy" for a standard numerical format like 12/31/2023.
Do I need Acrobat Pro to add this date script?
Yes, you need Adobe Acrobat Pro or Standard to author and embed document-level JavaScript. The free Adobe Acrobat Reader can execute the script when opening the file, but it does not have the tools required to create or inject the code.




