Skip to main content
David Healy
Inspiring
June 24, 2021
質問

I need help with Javascript in Acrobat

  • June 24, 2021
  • 返信数 1.
  • 12687 ビュー

In Acrobat I need:

  • a field “Date-2” that subtracts 2 days from a field named,“DateMAIN

Field “DateMAIN” will display the date as, “June 5, 2021”  (mmm d, yyyy)

Field “Date-2” will display the date as, “6/3/21”  (mm/dd/yy)

  • a field  “Time-330” that subtracts 3 hours and 30 minutes from a field named,“TimeMAIN

Field “TimeMAIN” will display the date as, “June 5, 2021”  (mmm d, yyyy)

Once I obtain the code do I enter it in the Custom Calculation Script window?

このトピックへの返信は締め切られました。

返信数 1

bebarth
Community Expert
Community Expert
June 24, 2021

For the Day-2 field, in validation script of the DateMAIN field place this script:

this.getField("Day-2").value=util.printd("mm/dd/yy", new Date(util.scand("mmm d, yyyy",event.value)-(1000*3600*24*2)));

The format of the DateMAIN field is "mmm d, yyyy".
I don't understand the format of both time fields are not they in a time format?
@+

David Healy
David Healy作成者
Inspiring
June 24, 2021

Which window should I enter this code into: JavaScript Debugger, Actions, Custom Calculation Script or other?

 

Attached is how it should look:

David Healy
David Healy作成者
Inspiring
June 27, 2021


Note: I changed the names for the fields.

For the date subtraction I tried:

this.getField("D-2").value=util.printd("mm/dd/yy", new Date(util.scand("mmm d, yyyy",event.value)-(1000*3600*24*2)));

It posted the date “12/29/69” instead of “6/10/21”