PDF Editing Issues

Convert a Digital Signature Date to Text in Acrobat JavaScript

Tauseeq MagsiTauseeq Magsi Nov 19, 2026 869 views

Question details

Convert a digital signature date returned by Acrobat JavaScript into text for a PDF form field.

Convert a Digital Signature Date to Text in Acrobat JavaScript
Product
Adobe Acrobat JavaScript
Device & OS
not provided
Scenario
A PDF form script reads a signature field with signatureInfo() and needs to display its date in a text field.
Observed behavior
The signature date may be a Date object rather than plain text, and JavaScript has no built-in Left function.
Before you start

Open the PDF in Acrobat and confirm the names of the signature and destination text fields. Make sure the signature field contains a signature with a valid date and that the document permits the intended form-field change.

Solution 1Recommended

Format the signature date with Acrobat JavaScript

Use util.printd to turn a valid signature date into a formatted string before assigning it to a text field.

1
Open the JavaScript console

Open the signed PDF in Acrobat, then open the JavaScript console from Acrobat's JavaScript tools.

2
Format and assign the date

Enter and run this script, replacing Signature1 and Text2 with your field names: var sig = this.getField("Signature1"); var target = this.getField("Text2"); if (!sig || !target) throw new Error("Check the field names."); var info = sig.signatureInfo(); if (!info || !(info.date instanceof Date) || isNaN(info.date.getTime())) throw new Error("No valid signature date found."); var dateText = util.printd("mm/dd/yyyy", info.date); target.value = dateText;

3
Extract part of the text if needed

To use only the first five characters, replace the final assignment with target.value = dateText.substring(0, 5);. This returns the month and day from the mm/dd/yyyy format.

Format the signature date with Acrobat JavaScript
Check signature permissions: Changing a form field after signing may be restricted or may affect signature validation, depending on the document's signature settings.
Free Microsoft Office alternative

Work with PDFs and Office files in WPS Office

WPS Office is a free, lightweight alternative with a familiar interface for everyday PDF and Office work. Its support for common Microsoft Office formats makes it easy to move existing files, but it does not replace Acrobat's signatureInfo() JavaScript API.

Open and review PDF documents alongside other filesWork with Microsoft Word, Excel, and PowerPoint formatsUse a familiar interface for everyday document tasksMove existing Office files into a lightweight workspace
microsoft office alternative - wps office

Frequently Asked Questions

Why can't I use Left() in Acrobat JavaScript?

JavaScript has no built-in Left function. After formatting the date as text, use dateText.substring(0, 5) to get its first five characters.

How do I display the full signature date in a text field?

Read the signature field with signatureInfo(), format its valid date with util.printd("mm/dd/yyyy", info.date), and assign the result to the destination field's value.

What should I check if the script reports no valid signature date?

Check the signature field name in Acrobat and confirm that the field contains a signature. The example requires info.date to be a valid JavaScript Date object.

Can writing the date to a field affect the signature?

It can. Check the signature and document permissions before changing the field; changes after signing may be restricted or affect signature validation.