2 Replies Latest reply on Mar 6, 2015 11:33 AM by George_Johnson

    Next business day


      I have the following script found online:


      // Custom calculate script for "to" field 
      (function () { 
          // Get date from field 
          var v = getField("Date").valueAsString; 
          // Convert string to date 
          var d = util.scand("mm/dd/yyyy", v); 
          // Add 1 day 
          d.setDate(d.getDate() + 1); 
          // Populate this field with the result 
          if (v) { 
              event.value = util.printd("mm/dd/yyyy", d); 
          } else { 
              event.value = ""; 


      I have a text box set up to put in the current date ("Date").


      How can I skip the weekends with this script and enter the next business date?

        • 1. Re: Next business day
          gkaiseril MVP & Adobe Community Professional

          You need to test the day of the week for the date. The getDay() method returns the zero based day of the week starting with Sunday. So if the return value for the getDay method is 0 or 6 you need to add 1 more day for the zero value and 2 more days for the 6 value.

          • 2. Re: Next business day
            George_Johnson MVP & Adobe Community Professional

            It would be easy if business days were simply defined as not Saturday or Sunday, but that's not universally the case. Non-business days include national/regional/religious holidays that may be observed by some, but not necessarily all. The point is you need to provide a complete definition of "business day" before trying to code for it.