I have the following javascript to calculate the # of days between two dates and it works like a charm. However I need to exclude weekends in the calculation. Any thoughts? I looked through other posts and found one similiar request but I could not make sense of it. I also need the answer to be 1 if the start date and end date are the same. Any suggestions?
var strStart = this.getField("txtRevStart").value;
var strStop = this.getField("txtRevStop").value;
if(strStart != "" & strStop != "")
{
var dateStart = util.scand("mm/dd/yyyy",strStart);
var dateStop = util.scand("mm/dd/yyyy",strStop);
var diff = dateStop.getTime() - dateStart.getTime();
// One Day = (24 hours) x (60 minutes/hour) x
// (60 seconds/minute) x (1000 milliseconds/second)
var oneDay = 24 * 60 * 60 * 1000;
var days = Math.floor(diff/oneDay);
event.value = days;
}
else{
event.value= ""}
- AcrobatUsers Community Expert - Contact me personally at try6767 [at] gmail [dot] com
Check out my custom-made scripts website: http://try67.blogspot.com