Reverse Plus and Minus Signs in an Acrobat PDF Form
Question details
Display a date difference in an Acrobat PDF form with a plus sign for negative results, a minus sign for positive results, and no sign for zero.

- Product
- Adobe Acrobat
- Device & OS
- not provided
- Scenario
- A PDF form calculates the difference between two dates and needs a D-Day-style result.
- Observed behavior
- The result should show the opposite sign from the underlying date difference, while displaying zero as 0.
Identify the field or calculation that produces the numeric date difference and check the exact field names in Acrobat. The script must use that calculation or a separate source field, not read the result field itself.
Use a custom calculation script to reverse the displayed signs
Use this method when the form already calculates a numeric date difference and needs to display it with reversed signs.
The example reads a numeric difference from a separate field named DaysDifference. If your existing calculation is in the result field, retain its calculation logic and use its numeric result in place of the source-field value below.
Open the PDF in Adobe Acrobat and select All tools > Prepare a form. Right-click the field that will display the result and choose Properties.
In the field properties, open the Format tab and select None. This lets the script supply the displayed sign as text.
Open the Calculate tab, select Custom calculation script, and click Edit. Enter the script below, replacing DaysDifference with the name of the separate field containing the numeric date difference: var raw = this.getField("DaysDifference").valueAsString; if (raw.trim() === "" || isNaN(Number(raw))) { event.value = ""; } else { var diff = Number(raw); if (diff < 0) event.value = "+" + Math.abs(diff); else if (diff > 0) event.value = "-" + diff; else event.value = "0"; }
Close the properties dialog, select Preview in Prepare a form, and enter dates that produce a negative difference, a positive difference, and zero. Check that the results show a plus sign, a minus sign, and 0, respectively.

Work with PDFs and date calculations in WPS Office
WPS Office is a free, lightweight alternative for viewing PDFs and working with date calculations in spreadsheets. Its familiar interface and Microsoft Office format support make it easier to move existing files. It does not replace Acrobat's custom form calculation script.

Frequently Asked Questions
Why should the result field format be set to None?
In the field's Properties > Format tab, select None so the custom calculation script can supply the plus or minus sign as text rather than relying on number formatting.
What should I replace DaysDifference with in the script?
Replace it with the exact name of a separate field that contains the numeric date difference. Find the field name in its Properties dialog in Prepare a form.
How will the script display zero?
The script sets the result to 0 without a sign when the numeric difference is zero. Test this by entering two dates that produce a zero difference in Preview.
What if the displayed result does not update correctly?
Check the field name and use the form editor's field calculation order settings to ensure the numeric difference is calculated before the display field. Then test again in Preview.




