1 Reply Latest reply on Jun 24, 2012 8:28 AM by gkaiseril

    Date Calculation - 1st of month following x days

    ctgizmo Level 1

      How do I calculate a date equal to 1st of the month following 30 days of employment but if the date of hire is on the 1st then xDate is 1st of the following month?

       

      For example, DOH is 2/2/12 then xDate = 4/1/12.  If DOH is 2/1/12 then xDate = 3/1/12.

       

      Thanks for your help.

        • 1. Re: Date Calculation - 1st of month following x days
          gkaiseril MVP & Adobe Community Professional

          Both JavaScript and FormCalc have a date object that uses an Epoch date as a zero number for date and time calculations but there are some differences in how the date number and time come out of the object.

           

          You need to convert your date string to a date object and then pull the date from that object so you can test if the hire date is the 1st or not. If it is the first then you will need to adjust the month value of the date object. You can then add the thirty days to the date object. You can now format the result of your calculation.