JavaScript – Displaying the Date

How to display the date using JavaScript.

  1. Create a text field using the form tool.
  2. Click the format tab and select an appropriate date format.
  3. Click the calculate tab and select custom and enter the following:

event.value = util.printd('mm/dd/yyyy', new Date());

If you want the field only to be populated once (for example, the first time
the form is opened or reset but not subsequently) you can modify the script

if (event.value == '')

event.value = util.printd('mm/dd/yyyy');

You May Also Like

About the Author: Planet PDF Team

Leave a Reply