Link to home
Start Free TrialLog in
Avatar of marc_butler
marc_butler

asked on

Calculate Working Days

Hi All,

Ive found this code on an existing post. But when I change it to meet my needs it wont work. Please see below code.

This is the error I get;
Microsoft VBScript runtime error '800a000d'
Type mismatch: '[string: "10/03/2009"]'
/hr/RTW_Form.asp, line 5

On line 5 if I change Request.Form("LastDateOfAbsence") for Date() it works fine.

Any idea's?

Beav
<%
If Request.Form("FirstDateOfAbsence") <> "" And Request.Form("LastDateOfAbsence") <> "" Then
  Dim strWorkingDays
  strWorkingDays = 0
  For i = Request.Form("FirstDateOfAbsence") To Request.Form("LastDateOfAbsence")
    If WeekDay(i) <> 7 And WeekDay(i) <> 1 Then
      strWorkingDays = strWorkingDays + 1
    End If
  Next
Response.Write(strWorkingDays)
End If
%>

Open in new window

Avatar of Wayne Barron
Wayne Barron
Flag of United States of America image

usually you would wrap a # around the Date, but I cannot find no information on
Wrapping it around a Form("") item....?

Still checking.
Carrzkiss
ASKER CERTIFIED SOLUTION
Avatar of Wayne Barron
Wayne Barron
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Your welcome, I think you are anyway?

Have a good one.
Carrzkiss
Avatar of marc_butler
marc_butler

ASKER

Im sorry carrzkiss,

Thank you very muchly.

Beav
You are so very welcome.
I knew you would come in and say thank you....
You rock.
Keep up the coding.

Carrzkiss