Copy link to clipboard
Copied
I need to calculate a new date based off another date and exclude weekends.
For example I have a field called "Date Position Closed". If I enter a date of 5/20/2016 it should populate another field called "Target Date QRB" with 9/27/2016. Which is 90 business days after the initial date.
So far this is what I have, but it calculates based off all calendar days:
var strStart = this.getField("DatePositionClosed").value;
if(strStart.length)
{
var DatePositionClosed = util.scand("m/dd/yyyy",strStart);
var oneDay = 24 * 60 * 60 * 1000;
var dueMillis = DatePositionClosed.getTime() + 130 * oneDay;
var dueDate = new Date(dueMillis);
event.value = util.printd("m/dd/yyyy",dueDate);
}
else
event.value = "NA";
Copy link to clipboard
Copied
Do we have to account for holidays or feast days?
If so this makes the script far more complicated since these special days might not be fixed from year to year.
Copy link to clipboard
Copied
No need to account for holidays.
Copy link to clipboard
Copied
As mentioned, this would require quite a complex script to be developed. If you're interested, I've already developed a script that allows you to set up exactly this kind of calculation, including the option to ignore weekends and holidays (you can specify the list of holidays for your country). It can be purchased from here: Custom-made Adobe Scripts: Acrobat -- Apply Automatic Date Calculation
Find more inspiration, events, and resources on the new Adobe Community
Explore Now