GetwWorkDays Funcion:
Get work days between a interval
Description:
Get work days count between a dates interval excluding saturdays and sundays.
Syntax:
GetWorkDays(start_date, end_date)
Example:
<%
Response.Write GetWorkDays("10/04/2010", "10/27/2010")
Result: 17
%>
ASP Source Code:
<%
Function GetWorkDays(start_date, end_date) Dim workingnumberofdays, whatisday, findday, i If IsDate(start_date) And IsDate(end_date) Then findday = datediff("d", start_date, end_date) Else amtWorkDays = 0 Exit Function End If for i = 1 to findday whatisday = weekday(dateadd("d", i, cdate(start_date) - 1)) if whatisday <> 1 and whatisday <> 7 then workingnumberofdays = workingnumberofdays + 1 end if next GetWorkDays = workingnumberofdays End Function
%>
|