Vietnam Visa
Vietnam Visa

Reputation: 1

Adobe Acrobat Form, getting data with 2 different format

Here is my problem: On fill_1, I have a date in "dd/mm/yyyy" format On fill_17, I have the same value but I want it to be in another format like: mmmm dd, yyyy How can I do this? Thanks a lot

Upvotes: 0

Views: 835

Answers (1)

Max Wyss
Max Wyss

Reputation: 3605

Either in the onBlur or Format event (if available for Custom formatting) of fill_1 or in the Calculate event of fill_17, you read out the date in fill_1, create a Date object, using util.scand(), and set the value of fill_17 using that date object and format with util.printd().

for the first case, this would look like this:

var theDate = util.scand("dd/mm/yyyy", event.value) ;
this.getField("fill_17").value = util.printd("mmmm dd, yyyy", theDate) ;

for the second case, it would look like this:

var theDate = util.scand("dd/mm/yyyy", this.getField("fill_1").valueAsString) ;
event.value = util.printd("mmmm dd, yyyy", theDate) ;

and that should do it.

Upvotes: 1

Related Questions