2 Replies Latest reply on Jan 8, 2014 10:31 AM by iamcolindarling

    Javascript Month Trend Calculation Using Date

    iamcolindarling

      Hello,

       

      I have search the forum, but I'm not able to identify anything that specifically answers my script question.

       

      I am using Adobe Acrobat 9 and I'm a javascript novice and intermediate form builder.

       

      I would like to create a custom calculation script using information stored in a field. The field is a text field formatted as a date "mm/dd/yyyy"

       

      I'm trying to create a monthly straight line trend.

       

      Example:

       

      User Input Date: 01/10/2014 (Month/Day/Year); cannot be driven by current system date, must be user entered

      Units to Date: 10 Units

       

      Monthly Straight Line Trend is 31 units (This is what I would like to calculate)

       

      Formula =  (Units/Day)*Max Days of Month

       

      To accomplish my goal, I need to solve for the following hangups:

       

      1) Can I extract the "Day" from the date text field?

      2) Can I derive the "Max" number of days in a given Month/Year?

      3) Can I tie the script together so I don't need to have a "DAY" text field and a "MAX DAY" text field?

       

      Any help would be very much appreciated.