|
Functions -- The WorkingDays
function
This page demonstrates how to make a function
and display it's results in your page.
filename=/learn/test/functionworkingdays.asp
<title>functionworkingdays.asp</title>
<body bgcolor="#FFFFFF">
<%
response.write "3 working days from today is " & dtaddWorkingDays(now(),3) & "<p>"
%>
2 working days from today is <%=dtaddWorkingDays(now(),2)%>
</body>
<%Function dtAddWorkingDays(dtStartDate, nDaystoAdd)
'Adds working days based on a five day week
Dim dtEndDate
Dim iLoop
'First add whole weeks
dtEndDate=DateAdd("ww",Int(nDaysToAdd/5),dtStartDate)
'Add any odd days
For iLoop = 1 To (nDaysToAdd Mod 5)
dtEndDate=DateAdd("d",1,dtEndDate)
'If Saturday increment to following Monday
If WeekDay(dtEndDate)=vbSaturday Then
'Increment date to following Monday
dtEndDate=DateAdd("d",2,dtEndDate)
End If
Next
dtAddWorkingDays=dtEndDate
End Function
%>
 |  |  |
 |
There are many worthy charities!!. But perhaps help starving children in Africa or South America AND help Charles too.
a $5 tip buys him lunch at McDonalds,
a $20 tip buys his kid Hitoshi a new computer game,
a $39 tip buys his daughter Michiko a few nice outfits.
See our donor list.
|  |
 |  |  |
|
|
|
|