Date differents

1. sr
Member
Join Date
Dec 1969
Posts
55

## Date differents

Hi <BR>I like to get a number of days between start date and end date<BR>of vacation for employee except saturday, sunday and holidays in leave period.<BR><BR>

2. Senior Member
Join Date
Dec 1969
Posts
11,334

## Great!

Tell us how it turns out!

3. sr
Member
Join Date
Dec 1969
Posts
55

## RE: Great!

Here is the code I can calculate how many total days<BR>var bufferA = Date.parse (aLeaveStart);<BR>var bufferB = Date.parse (aLeaveEnd);<BR> var number = bufferB- bufferA;<BR> iOut = parseInt(number/86400000);<BR>here it is print total number of days<BR>in that day&#039;s I need loop through and count the total week end and national holidays to subract from the total days<BR>so I used<BR><BR>var setDate = new Date (aLeaveStart);<BR> <BR> var endDate = new Date (aLeaveEnd);<BR><BR><BR>while (iOut &#062; 0 ){<BR> var lngWeekDay = setDate.getDay();//weekday(dtTemp) <BR> Response.Write("the"+lngWeekDay);<BR> if ((lngWeekDay != 6) && (lngWeekDay != 0)){ <BR> var lngVacDays;<BR> lngVacDays = lngVacDays + 1 ;<BR> Response.Write ("the num"+lngWeekDay);<BR> }<BR> dtTemp = DateAdd("d", 1, dtTemp) <BR>}<BR> Response.Write (dtTemp);

4. sr
Member
Join Date
Dec 1969
Posts
55

## Correction

var bufferA = Date.parse (aLeaveStart);<BR>var bufferB = Date.parse (aLeaveEnd);<BR>var number = bufferB- bufferA;<BR>iOut = parseInt(number/86400000);<BR>here it is print total number of days<BR>in that day&#039;s I need loop through and count the total week end and national holidays to subract from the total days<BR>so I used<BR><BR>var setDate = new Date (aLeaveStart);<BR><BR>var endDate = new Date (aLeaveEnd);<BR>var num=1;//advanced by one day<BR>var dtTemp;<BR> num *= 24 <BR> dtTemp = new Date( bufferA + num )<BR><BR>while (iOut &#062; 0 ){<BR>var lngWeekDay = dtTemp.getDay();//weekday(dtTemp) <BR>Response.Write("the"+lngWeekDay);<BR>if ((lngWeekDay != 6) && (lngWeekDay != 0)){ <BR>var lngVacDays;<BR>lngVacDays = lngVacDays + 1 ;<BR>Response.Write ("the num"+lngWeekDay);<BR>}<BR>}<BR>Response.Write (dtTemp);

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•