Convert a Digital Signature Date to Text in Acrobat JavaScript
Question details
Convert a digital signature date returned by Acrobat JavaScript into text for a PDF form field.

- 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.
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.
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.
Open the signed PDF in Acrobat, then open the JavaScript console from Acrobat's JavaScript tools.
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;
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.

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.

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.




