PDF Editing Issues

How to Automatically Add a Date to a PDF Signature Field

Chanuka GeekiyanageChanuka Geekiyanage Nov 2, 2026 869 views

Question details

The user wants to automatically generate and display the current date and time in a specific text field the moment a PDF signature field is signed.

Automatically Add a Date to a PDF Signature Text Field
Product
PDF
Device & OS
not provided
Scenario
Creating or setting up interactive PDF forms that require automatic timestamps upon applying a digital signature.
Observed behavior
A separate text field needs to be dynamically populated with the exact system date and time when a signature is applied to the document.
Before you start

Ensure you have a PDF editor that supports advanced form creation and JavaScript functionality. You will need to create both a digital signature field and a separate target text field in your document before applying the script.

Solution 1Recommended

Use JavaScript on the Signature Field's Signed Event

Run a JavaScript code snippet triggered by the document's signing event to populate a read-only text field with the current timestamp.

By attaching a JavaScript action directly to the 'Signed' event of your signature field, you can capture the exact moment a user signs the PDF. The code pulls the operating system's current date and time and writes it into your designated target text field automatically.

1
Create a target text field

Create a standard text field in your PDF where you want the date to appear. Name it 'SignatureTime' (or another name of your choice). Open its properties and check the 'Read Only' box so users cannot manually edit the date.

2
Access signature field properties

Right-click on your digital signature field and select 'Properties' from the context menu.

3
Navigate to the Signed event

Go to the 'Signed' tab (this might be located under 'Actions' depending on your specific PDF editor) and choose 'Run a JavaScript' as the action.

4
Enter the JavaScript code

Type or paste the following code into the JavaScript editor: this.getField("SignatureTime").value = util.printd("mm/dd/yyyy HH:MM", new Date());

5
Save and test

Save your PDF document. Test the functionality by applying a digital signature; the text field should instantly populate with the current date and time.

Use JavaScript on the Signature Field's Signed Event
Match Field Names Exactly: Ensure that the field name used in the JavaScript snippet exactly matches the name of your target text field. JavaScript is case-sensitive, so 'Signaturetime' and 'SignatureTime' will be treated as completely different fields.
Edit and Sign PDFs Easily

Sign and Edit PDFs Effortlessly with WPS Office

WPS Office provides a robust PDF editor that makes adding text, filling forms, and applying digital signatures to your documents incredibly simple. Whether you are executing contracts or filling out interactive documents, WPS Office streamlines your workflow without requiring heavy subscription costs.

  1. 1. Open your PDF: Launch WPS Office and open the PDF document you need to sign.
  2. 2. Access signature tools: Navigate to the 'Fill & Sign' or 'Edit' tab located on the top ribbon.
  3. 3. Create a signature: Click on 'Sign' to create a new digital signature or insert an existing one into the document.
  4. 4. Add a date manually: If you are not using automated JavaScript forms, use the 'Add Text' tool to quickly place the current date right next to your signature.
  5. 5. Save the document: Click 'Save' or export your securely signed PDF document to share with others.
Easily add digital signatures, text, and dates to PDF contracts.Create, edit, and fill out interactive PDF forms seamlessly.High compatibility with standard PDF formats and Adobe Acrobat.Lightweight software that runs smoothly on Windows, Mac, and mobile devices.
microsoft office alternative - wps office

Frequently Asked Questions

Can I change the date and time format in the JavaScript code?

Yes, you can modify the parameters within the util.printd function. For example, changing 'mm/dd/yyyy HH:MM' to 'dd-mmm-yyyy' will format the output as '25-Oct-2023' instead of '10/25/2023 15:30'.

Why isn't the date updating when I sign the PDF?

This usually happens if the target text field name in your script doesn't exactly match the actual field name in the PDF properties. Check for typos, extra spaces, or capitalization errors in this.getField('YourFieldName'). Additionally, ensure the PDF reader you are using to sign the document fully supports JavaScript execution.

Do I need a paid PDF editor to add this script?

Generally, yes. While viewing, filling, and signing can be done in free PDF readers, adding interactive form fields and embedding custom JavaScript requires a premium PDF editor like Adobe Acrobat Pro or specialized PDF authoring software.

How do I make the date field read-only?

Right-click the target text field where the date will appear, go to Properties, select the 'General' tab, and check the 'Read Only' box. This ensures the date is only populated by the system script and cannot be tampered with manually.