Skip to main content
Inspiring
July 27, 2023
Answered

Format a Date Field to Another Formatting

  • July 27, 2023
  • 1 reply
  • 948 views

I worked on a Tool that can build PDF Forms. In this tool, I defined a DateTime field. I genereated an PDF Form which has a candenler that can allow user to choose the date. But the formatting is not what I wanted(see the image below). We wanted it shows MM/DD/YYYY

I posted formatting issue before which is about currency formating, the code is like this:

var Minisalary = this.getField("MiniSalary");
Minisalary.setAction("Format", "event.value = formatCurrency(event.value);");

 

So, I am wondering if we can do simialir code, like below to realize it, but I tried serval ways, it failed. 

var date= this.getField("my field");
date.setAction("Format", "event.value = ???;");

 

 

 

This topic has been closed for replies.
Correct answer Blair285268942h5r

There you can use the format "MM/DD/YYYY" for the date field. 


Could you please help on the coding?

 

var Date= this.getField("StartDate");
Date.setAction("Format", "event.value = formatDate ("MM/DD/YYYY");");

 

I don't know what function should be used here.

 

1 reply

Bernd Alheit
Adobe Expert
July 27, 2023

What version of Adobe Acrobat does you use?

Inspiring
July 27, 2023

Adobo Pro DC

Bernd Alheit
Adobe Expert
July 27, 2023

There you can use the format "MM/DD/YYYY" for the date field.