How to Use Yesterday's Date in an Adobe Acrobat Dynamic Stamp
Question details
The user needs to configure an Adobe Acrobat dynamic stamp to display the date from exactly one day before the stamp is applied, rather than the current date.

- Product
- Adobe Acrobat
- Device & OS
- not provided
- Scenario
- Creating or editing a custom dynamic stamp for a PDF workflow where backdating by one day is required.
- Observed behavior
- The default JavaScript code for the dynamic stamp returns the current date as a string, which does not meet the user's requirement for displaying yesterday's date.
Ensure you have Adobe Acrobat Pro or Standard installed. The free Adobe Acrobat Reader allows you to apply stamps but does not support the creation or editing of custom dynamic stamps using JavaScript.
Use JavaScript with Date Formatting (util.printd)
This method cleanly subtracts a day from the current Date object and formats the output, automatically handling month and year boundaries correctly.
By manipulating the JavaScript Date object directly, you can adjust the day backwards without worrying about calculating the varying lengths of months or leap years.
In Adobe Acrobat, go to Tools > Stamp > Custom Stamps > Manage to access your custom stamp collection.
Select the dynamic stamp you want to modify, open it for editing, and locate the calculation script for the date text field.
Replace the existing date code with the following snippet: var d = new Date(); d.setDate(d.getDate() - 1); event.value = util.printd("h:MM tt, mm/dd/yyyy", d);
Save your changes, close the stamp editor, and apply the stamp to a test PDF document to verify it displays yesterday's date.

Use Basic JavaScript String Output
A simpler alternative that outputs the unformatted default string representation of yesterday's date, suitable if specific formatting is not strictly required.
Easily Manage and Apply Custom Stamps in PDFs with WPS Office
While scripting dynamic stamps in Acrobat requires JavaScript knowledge, WPS Office provides an intuitive, user-friendly interface to easily create, customize, and add text or image stamps to your PDF documents without any coding.
- 1. Open Your PDF: Launch WPS Office and open the PDF document you want to stamp.
- 2. Access the Stamp Tool: Navigate to the Comment tab on the top ribbon and click on the Stamp tool icon.
- 3. Create a Custom Stamp: Select 'Click to Add' or 'Custom Stamp' from the dropdown menu to create a new stamp template.
- 4. Customize and Apply: Enter your desired text (such as a specific date) or upload a custom image, then click anywhere on your PDF document to apply the stamp.

Frequently Asked Questions
Why does subtracting a day manually sometimes result in an invalid date?
If you just subtract 1 from the current day value mathematically without using the setDate() method, the script won't account for the transition between months (e.g., from May 1 to April 30). Using d.setDate(d.getDate() - 1) forces the JavaScript Date object to recalculate the correct month and year naturally.
Can I format the date differently in my Acrobat dynamic stamp?
Yes, the util.printd function allows for various formatting strings. For example, changing the format string to 'yyyy-mm-dd' will output the date in a standard international format (e.g., 2023-10-25).
Do custom dynamic stamps work in the free Acrobat Reader?
You can apply dynamic stamps that have already been created using the free Acrobat Reader, and the JavaScript will execute. However, you need Acrobat Standard or Pro to initially create or edit the custom JavaScript behind the stamp.




