Use a Calculated Date Value in Adobe Acrobat Form Scripts
Question details
The user wants to extract the day from a Start Date field and reuse it in other Acrobat form field scripts.

- Product
- Adobe Acrobat PDF forms
- Device & OS
- not provided
- Scenario
- A PDF form contains a Start Date field, and other fields need to use its day value.
- Observed behavior
- The existing script displays the extracted day, but the user needs to access that value from other field scripts.
Open the PDF in Adobe Acrobat and check the exact name and displayed format of the Start Date field. The examples below assume the field is named Start Date and uses the mm/dd/yyyy format with slashes.
Calculate the day in a field and reference it from other scripts
Use a calculated form field when several scripts need the same day value.
A variable declared inside one field script is not automatically available to other field scripts. Storing the result in a form field gives those scripts a value they can read.
In Acrobat, open the PDF and select Prepare a form. Add a text field named Start Day, or select an existing field for the result.
Open Start Day Properties, select Calculate, choose Custom calculation script, and click Edit. Enter: var dateText = this.getField("Start Date").valueAsString; var parts = dateText.split("/"); event.value = parts.length === 3 ? parts[1] : "";
In another field's custom script, read the result with: var SDD = this.getField("Start Day").valueAsString; Use Number(SDD) if the script needs a number rather than text.
Close form editing and enter a date such as 04/15/2026 in Start Date. Confirm that Start Day shows 15 and that the dependent field uses it. If necessary, use the form editor's field calculation order settings to calculate Start Day before dependent fields.

Read the day directly from the Start Date field
Use this approach when a script needs the day but a separate Start Day field is unnecessary.
Manage date calculations in WPS Spreadsheets
For a spreadsheet-based workflow, WPS Office is a free, lightweight alternative with a familiar interface and support for common Office formats. It does not fix Acrobat form scripts, but you can use spreadsheet formulas to calculate and reuse date values.

Frequently Asked Questions
Why can't another field script see my SDD variable?
A variable declared inside one field script is local to that script. Read the Start Date field directly with this.getField("Start Date") or store the extracted day in a separate field that other scripts can reference.
How do I get the day from a date entered as mm/dd/yyyy?
Read the field's valueAsString, split it with split("/"), and use the second array element, parts[1]. For example, 04/15/2026 produces the text value 15.
What if my date uses periods instead of slashes?
Change split("/") to split(".") if periods are the actual separators. Also check the date order: in dd.mm.yyyy, the day is parts[0], not parts[1].
Why does a dependent field show an old value?
In the form editor, check the field calculation order and place Start Day before fields that read it. Also check Acrobat's Forms preferences to ensure automatic field calculation is enabled.




