PDF Editing Issues

Create a PDF Date Field With Current Date in DD/MM/YYYY Format

Aamir Naveed AkramAamir Naveed Akram Oct 28, 2026 869 views

Question details

The user wants to configure a PDF form field to automatically populate with the current date in a specific format (DD/MM/YYYY) upon clicking.

How to Create a PDF Date Field with the Current Date in DD/MM/YYYY Format
Product
PDF Editor
Device & OS
not provided
Scenario
Creating an interactive PDF form where users need to quickly input today's date without manually typing it out.
Observed behavior
The user needs a JavaScript solution to capture the current date and format it strictly as day, month, and year, without the timestamp.
Before you start

Ensure you have a PDF editing tool that supports interactive form fields and JavaScript actions, such as Adobe Acrobat Pro or WPS Office PDF Editor.

Solution 1Recommended

Use JavaScript to Auto-Fill the Current Date on Click

Add a Mouse Up event script to the PDF text field to automatically fetch and format the current date.

Interactive PDF forms support JavaScript to automate data entry. By binding a simple script to the 'Mouse Up' trigger, the text field will instantly populate with the exact current date whenever a user clicks on it.

1
Open form editing mode

Open your PDF document in your PDF editor's form editing mode and create a new text field (or select an existing one where the date should appear).

2
Access field properties

Right-click the text field and select "Properties" from the context menu to open the Text Field Properties dialog box.

3
Navigate to the Actions tab

Click on the "Actions" tab at the top of the Properties dialog box.

4
Set up the JavaScript trigger

Choose "Mouse Up" from the Select Trigger dropdown menu. Then, choose "Run a JavaScript" from the Select Action dropdown menu and click the "Add" button.

5
Enter the JavaScript code

In the JavaScript Editor window that appears, enter the following code: event.target.value = util.printd("dd/mm/yyyy", new Date());

6
Save and test

Click "OK" to save the script, then click "Close" to exit the properties window. Switch to the hand tool or preview mode and click the field to ensure the date populates correctly.

Use JavaScript to Auto-Fill the Current Date on Click
Format Customization: You can easily change 'dd/mm/yyyy' to 'mm/dd/yyyy' or other standard date formats within the script to match your regional date formatting preferences.
Powerful PDF Editor

Create and Edit PDF Forms with WPS Office

WPS Office provides a comprehensive PDF editor that allows you to create interactive forms, add text fields, and manage document properties seamlessly.

  1. 1. Download WPS Office: Download and launch WPS Office, then open your PDF document in the application.
  2. 2. Access Form Tools: Navigate to the 'Form' tab on the top ribbon to access the interactive form creation tools.
  3. 3. Add and Configure Fields: Click 'Text Field' to insert a box, right-click to open its properties, and configure your desired actions or formatting.
  4. 4. Save the Interactive PDF: Save your newly customized interactive PDF document to share it with your clients or team.
Easily insert and manage interactive form fields like text boxes, checkboxes, and date fields.Highly compatible with Adobe Acrobat PDF forms and standard PDF formats.Lightweight software with an intuitive, user-friendly interface.Free to download and use for all your essential office tasks.
microsoft office alternative - wps office

Frequently Asked Questions

Can I set a PDF date field to format as MM/DD/YYYY instead?

Yes. Simply modify the JavaScript code to event.target.value = util.printd("mm/dd/yyyy", new Date());. The util.printd function in PDF JavaScript accepts various standard date formatting patterns.

Why isn't the date updating when I click the field?

Ensure that JavaScript is enabled in your PDF viewer's preferences. If you are using a basic PDF reader or a web browser preview, JavaScript actions on form fields might not be supported. Use a dedicated PDF editor to test the functionality.

How do I prevent users from typing an incorrect date manually?

You can add form validation scripts to ensure manually entered dates match your required format. Alternatively, setting the field to 'Read Only' prevents manual typing, but depending on the PDF viewer, it may also prevent the 'Mouse Up' click event from triggering. Testing in your target PDF viewer is recommended.

Does this JavaScript add the time to the field as well?

No, the script util.printd("dd/mm/yyyy", new Date()) explicitly formats the output to only show the day, month, and year. The time data retrieved by the new Date() function is safely ignored by the formatting string.