3 Replies Latest reply on Apr 3, 2008 4:00 PM by (Jennifer_Butzgy)

    Date Field / Calculating Adobe Designer

      I have four fields within a Payroll Attendance Report in Adobe Designer.

      Payroll Period:
      1. FromDate
      2. ToDate

      Week Ending:
      3. WeekEndingDate1
      4. WeekEndingDate2

      I only want to be able to enter the Date Field "FromDate" and have the other three calculate automatically. ToDate will be +13 days, WeekEndingDate1 wiill be +6, and WeekEndingDate2 will also be =13 days from the FromDate.

      This is driving me crazy b/c I can not figure out what to put in the *Calculation in FormCalc. Please help!
        • 1. Re: Date Field / Calculating Adobe Designer
          gkaiseril MVP & Adobe Community Professional
          FormCalc provide the "Date2Num()" and "Num2Date()" functions to provide the ability to compute dates.

          The "Date2Num()" function converts a date string to the number of days since the FormCalc Epoch date. This number days can then be used in a mathmatical calclulation. If you add 13 days to it you will have the number of days from the Epoch date for 13 days fromt the initial date.

          The "Num2Date()" function will take a number, assumed to be the number of days from FromCalc's Epoch date, and return a fromatted date string for that date.

          The basic FormCalc for the "ToDate" calculation script could be with a date format of "MMM DD, YYYY" for all date fields:

          Num2Date( (Date2Num(FromDate.formattedValue, "MMM DD, YYYY") + 13) )

          Date2Num(FromDate.formattedValue, "MMM DD, YYYY") - get the days frm the Epoch date

          Date2Num(FromDate.formattedValue, "MMM DD, YYYY") + 13 - add 13 days

          Num2Date( (Date2Num(FromDate.formattedValue, "MMM DD, YYYY") + 13) )
          - convert resulting number back to a formatted date string.
          • 2. Re: Date Field / Calculating Adobe Designer
            Level 1
            WOW! Thank you very much for responding so quickly. I am just very confused on where to put the above information. The "FromDate" field is a Date Field and that would be the Epoch Date. What to I put in the *calculation for "ToDate" to have that be 13 days after the "FromDate"?

            Sorry I am just confused.
            • 3. Re: Date Field / Calculating Adobe Designer
              Level 1
              No matter what functions I put in the Calculation Script of the "ToDate" field to have that field calculate the "FromDate" +13 additional days forward it doesn't work. I either get a Script Error or it gives me a completely incorrect date that automatically comes up before I even put in the "FromDate". Please help. Thanks!