How to Autofill a Date in Another Acrobat Field with a Different Format
Question details
The user needs a method to automatically copy a date entered in one PDF form field (formatted as mm/dd/yyyy) into a secondary field displayed in a different format (yyyymmdd).

- Product
- Adobe Acrobat
- Device & OS
- not provided
- Scenario
- Creating or configuring an interactive PDF form where date data needs to be populated across multiple fields automatically, but displayed according to different formatting requirements.
- Observed behavior
- The user wants to input the date once in a standard format and have the form automatically calculate and populate the destination field using a custom numerical string format without requiring manual re-entry.
Ensure you have Adobe Acrobat Pro or an advanced PDF editor equipped with form creation tools, as basic PDF readers do not support custom JavaScript formatting for interactive fields.
Use Custom JavaScript to Format and Transfer Dates
Set a calculation script on the destination form field to automatically fetch and reformat the date entered in the source field.
By utilizing Acrobat's built-in JavaScript engine, you can map the value of one field to another while applying unique formatting rules natively within the destination field's properties.
Open your PDF document in Prepare Form mode. Locate your initial date field and note its exact name (for example, "firstDateField"). Ensure this field is configured to accept the standard date format (mm/dd/yyyy).
Right-click the destination field where you want the yyyymmdd format to appear and select Properties. Navigate to the Format tab. Choose "Date" from the format category dropdown, select "Custom", and type "yyyymmdd" into the custom pattern box.
While still in the Properties window for the destination field, click on the Calculate tab. Select the "Custom calculation script" radio button and click the Edit button.
In the JavaScript editor, type the following code: event.value = this.getField("firstDateField").value; (Make sure to replace "firstDateField" with the actual name of your source field). Click OK and close the Properties window.
Exit Prepare Form mode to test your document. Type a date in the source field and click outside the box; the destination field should automatically populate with the same date formatted as yyyymmdd.

Manage and Edit PDFs Easily with WPS Office
If you find advanced PDF scripting complex, WPS Office provides an intuitive, user-friendly, and free alternative for managing PDF documents, filling standard forms, and maintaining your daily productivity without heavy software costs.
- 1. Download WPS Office: Visit the official WPS website to download and install the free, lightweight suite.
- 2. Open your PDF file: Launch the WPS PDF tool and open your existing interactive PDF forms or documents.
- 3. Edit and fill forms safely: Use the intuitive tools to fill standard form fields, add text, or sign your documents without dealing with complex code.

Frequently Asked Questions
Why is my destination date field remaining blank after entering a date?
This usually happens if the source field name in the JavaScript code does not exactly match the actual name of your field, or if the source field has not yet triggered a recalculation. Try clicking outside the source field to trigger the update.
Can I use a different custom date format like dd-mm-yyyy?
Yes. In the destination field's Format tab, simply select the Custom category and enter "dd-mm-yyyy" or your preferred pattern instead of "yyyymmdd". The calculation script will remain exactly the same.
Do these JavaScript date autofills work in standard web browsers?
Most default browser PDF viewers (like Chrome or Edge) do not fully support advanced PDF JavaScript calculations. Users should open the form in a dedicated PDF reader for calculation scripts to function reliably.
Is there a way to auto-copy data between PDF fields without using JavaScript?
To automatically copy data between fields without using scripts, both form fields must have the exact same name. However, this forces both fields to share the exact same format. To have different date formats, using a JavaScript calculation is required.




