need help

1. sr
Member
Join Date
Dec 1969
Posts
55

need help

I am calculating the total days between two set of date range<BR>- Need to subtract the weekend<BR>- Need to subtract this holidays <BR>labour day (first Monday of September), thanks giving Christmas(Dec 25), boxing day(Dec 26),new year(Jan 1) good Friday <BR>victoria day (third week of Monday of May) Canada day(July 1) civic holiday(it comes every first Monday of Aug)<BR>but I accomplished some holidays but not all of them<BR>Here is my code any one can help me because I having trouble get <BR>some holidays<BR><BR>// Get the milliseconds for this Date object. <BR>var bufferA = Date.parse (aLeaveStart);<BR>var bufferB = Date.parse (aLeaveEnd);<BR><BR><BR>var number = (bufferB+86400000) - bufferA;<BR> iOut = parseInt(number/86400000);<BR><BR> var dtTemp;<BR><BR>var i=0,k=0,d = 0,j=0;ju=0;<BR> <BR>while(i&#060;iOut){<BR>num = i*86400000;<BR>var nDays;<BR>var tot = (bufferA+num);<BR>dtTemp = new Date( tot )<BR><BR>var holMonth = dtTemp.getMonth();<BR>var holDate = dtTemp.getDate();<BR>var lngWeekDay = dtTemp.getDay();<BR>//to deduct the christmas and boxing holidays from the request date range<BR>if (holMonth == 11){<BR> <BR> if ((holDate == 25) &#124&#124( holDate == 26) ){<BR> d=d+1;<BR><BR> }<BR>}<BR>//to deduct the January first from the request date range<BR>if (holMonth == 0){<BR> if ((holDate == 1)){<BR> j=j+1; <BR> <BR> }<BR>}<BR>//to deduct the canaday day from the request range date<BR>if (holMonth == 6){<BR> if (holDate == 1){<BR> ju=ju+1; <BR> <BR> }<BR>}<BR><BR>// to deduct the week end from the request range date<BR>if ((lngWeekDay == 6) &#124&#124 (lngWeekDay == 0)){ <BR> k=k+1;<BR> }<BR> <BR> i=i+1;<BR><BR>}<BR><BR>if ((<BR>var lngVacDays=(iOut-k-ju-j-d);<BR><BR> Response.Write (lngVacDays);<BR>

2. Senior Member
Join Date
Dec 1969
Posts
96,118