PDF Editing Issues

How to Automatically Add a Date When Digitally Signing a PDF

Algirdas JasaitisAlgirdas Jasaitis Nov 3, 2026 869 views

Question details

The user needs to configure a PDF document so that the current date is automatically populated into a designated text field when a digital signature is applied.

How to Automatically Add a Date When a PDF Is Digitally Signed
Product
Adobe Acrobat PDF Form
Device & OS
not provided
Scenario
Creating an interactive PDF form that requires users to provide a dated digital signature upon completion.
Observed behavior
A script must be triggered to capture the exact time of signing and display the formatted date within a separate target text box on the document.
Before you start

Ensure you have a PDF editor that supports JavaScript for form fields, such as Adobe Acrobat Pro, and that your PDF already contains both a digital signature field and a target text field for the date.

Solution 1Recommended

Use JavaScript on the Signature Field's Signed Event

Attach a custom JavaScript action to the digital signature field so that it automatically fills in the current date when the user signs the document.

By leveraging Adobe Acrobat's form field properties, you can configure a script that executes precisely when the signature is applied. This ensures the date field perfectly matches the time of signing.

Make sure you know the exact name of your target date field (e.g., 'Text1') before writing the script, as the code will need to reference it directly.

1
Open Field Properties

Open your PDF form in preparation mode. Right-click the target Digital Signature field and select 'Properties' from the context menu.

2
Navigate to the Signed Tab

In the Properties dialog box, click on the 'Signed' tab located at the top right of the window.

3
Enable Script Execution

Select the radio button that says 'This script executes when field is signed', and then click the 'Edit' button to open the JavaScript editor.

4
Enter the JavaScript Code

Type or paste the following code into the editor: var d = new Date(); this.getField("Text1").value = d.getDate() + "/" + (d.getMonth() + 1) + "/" + d.getFullYear();

5
Update Field Name and Save

Replace "Text1" in the code with the actual name of your date text field. Click 'OK' to close the editor, then save the document.

6
Test the Output

Apply a test digital signature to the document to verify that the target text box automatically populates with the current date.

Use JavaScript on the Signature Field's Signed Event
Test Before Distribution: Always test the interactive form on a local copy before distributing it to end users to ensure the JavaScript executes correctly without security prompts blocking it.
Efficient PDF Management

Easily Sign and Date PDFs Using WPS Office

Skip the complex JavaScript code. WPS PDF allows you to add secure digital signatures that inherently display a timestamp and date directly within the signature block.

  1. 1. Open Your PDF: Launch WPS Office and open the PDF document you need to sign.
  2. 2. Access the Protect Tab: Navigate to the 'Protect' tab located on the top toolbar and click on 'Sign Document' or 'Digital Signature'.
  3. 3. Select or Create Digital ID: Choose your existing digital ID certificate from the list, or follow the prompts to create a new one.
  4. 4. Place the Signature: Click on the designated area in your document to place the signature. WPS Office will automatically embed the current date and timestamp into the visual signature block.
Automatically includes the date and time within the digital signature blockHighly compatible with Adobe Acrobat PDF document formatsNo programming or complex JavaScript required for standard signingLightweight, fast, and features an intuitive user interface
microsoft office alternative - wps office

Frequently Asked Questions

Does a digital signature automatically include a date?

Yes, standard digital signatures inherently contain a cryptographic timestamp of exactly when they were applied. However, inserting the date into a separate, highly visible text field requires additional scripting.

Can I automatically populate the signer's name using JavaScript too?

Yes, advanced JavaScript can be written to extract the signer's identity details from the digital certificate and auto-populate that information into a designated text box upon signing.

Why isn't my JavaScript executing when I sign the PDF?

JavaScript execution might be disabled in your PDF reader's security preferences. You must ensure that JavaScript is enabled in your software settings and that the document trusts the script.

Do I need premium software to add custom JavaScript to PDF forms?

Yes, adding embedded JavaScript to specific form field events, like the 'Signed' tab, typically requires advanced PDF authoring software such as Adobe Acrobat Pro.