13 Replies Latest reply on Jul 15, 2015 11:57 AM by try67

    Adding Month to Date

    Sean.twyman Level 1

      I'm trying to figure out how I can add a month properly to the date from a text field. I can add days (30, 90, 180)  but I need it in months (accounting for  leap year and such)

      So if the date is 7/14/15 then i need it to be 8/14/15 and such

      I am doing this 3 different ways

      1 month

      3 months

      6 months


      this is the code i have for the days.


      var sDate = this.getField("InvDate").value; // get date string
      var oDate = util.scand("mmm dd, yyyy", sDate); // convert to object
      oDate.setDate(oDate.getDate() + 90); // add 90 days to date



      Any Assistance is greatly appreciated.