How to Automatically Populate Date Fields in an Acrobat PDF Form
Question details
The user wants to automatically populate multiple date fields in a PDF time-card form based on a single entered week-ending date.

- Product
- Adobe Acrobat Pro
- Device & OS
- not provided
- Scenario
- Creating or editing a weekly time-card PDF form where multiple dates need to be calculated and populated automatically.
- Observed behavior
- The user needs a way to calculate and display the required dates offset from a main date field automatically.
Ensure you have access to Adobe Acrobat Pro or a PDF editor that supports JavaScript calculations for form fields, and verify that your source date field uses a consistent, standard date format.
Use Custom Calculation Scripts in Date Fields
Apply JavaScript using Acrobat's calculated field properties to automatically determine dates based on a source field.
You can automate date filling by utilizing custom JavaScript in the target field's calculation properties. This requires reading the source date, applying the needed offset (like subtracting days), and printing the new date format.
Open your PDF form in Acrobat Pro, go to the 'Tools' menu, and select 'Prepare Form' to access form editing capabilities.
Right-click the target date field (the one you want to auto-populate) and select 'Properties'.
Navigate to the 'Calculate' tab in the Properties window and choose the 'Custom calculation script' option.
Click 'Edit' and enter a script using `util.scand` to read the week-ending date. Calculate your offset by modifying the date object (e.g., subtracting days), and use `util.printd` to format the final result.
Close the properties window and test the form by entering a date in your source field to verify that the target field updates automatically.

Edit and Fill PDF Forms Easily with WPS Office
WPS Office includes a comprehensive PDF editor that allows you to easily view, fill, and manage PDF forms without needing heavy, expensive software.
- 1. Open PDF File: Download and install WPS Office, then open your PDF form using WPS PDF.
- 2. Access Form Tools: Navigate to the 'Form' tab on the top ribbon to access interactive form fields.
- 3. Fill or Edit: Fill in the required fields, and use the built-in PDF tools to manage or edit the document layout as needed.
- 4. Save and Export: Save or export your filled PDF securely to share with others without losing formatting.

Frequently Asked Questions
Why is my calculated date field showing an error in Acrobat?
This typically happens if the source date field is blank or contains an invalid format when the form opens. You can fix this by adding a condition in your JavaScript to check if the source field is empty before running the calculation.
What date format should I use for util.scand?
The date format in `util.scand` must exactly match the format of the date string you are trying to parse. For example, if your source field uses 'mm/dd/yyyy', your script must specify 'mm/dd/yyyy' as the format string.
Can I automatically calculate a date exactly one month from the source date?
Yes, by extracting the month from the parsed date object, incrementing it by one, and then setting the new date object before formatting it with `util.printd`.




