working with dates

B

Brett Atkin

I have a form where I pass a member's end date to a processing page.

The date is getting passed as a string so when I try to add to that date I
get an error.

Here is my code - the error message is below the code.

********************

<%
sub_amount = request("sub_amount")
end_date = request("end_date")
mem_email = request.form("mem_email")
mem_first = request.form("mem_first")
mem_last = request.form("mem_last")
mem_ezine = request.form("mem_ezine")

Select Case sub_amount

Case "31.50"
sub_term = "One Year"
mem_status = "Current"
start_date = end_date + 1
end_date = start_date + 365

Case "53.00"
sub_term = "Two Years"
mem_status = "Current"
start_date = end_date + 1
end_date = start_date + 730

End Select
%>

********************

the error message.

********************
Error Type:
Microsoft VBScript runtime (0x800A000D)
Type mismatch: '[string: "7/22/2003"]'
/powerquotes_plus/Connections/subscriptions.asp, line 14
********************

Question:

How do I convert the string date (end_date) to a format that I can work
with?

Thanks

Brett
 
B

Brett Atkin

Bob,

I knew that, I just couldn't it in my brain, I was drawing a blank. Thank
you for the quick answer.

It did help

Brett


Bob Barrows said:
Use CDate to convert the string to date.

HTH,
Bob Barrows

Brett said:
I have a form where I pass a member's end date to a processing page.

The date is getting passed as a string so when I try to add to that
date I get an error.

Here is my code - the error message is below the code.

********************

<%
sub_amount = request("sub_amount")
end_date = request("end_date")
mem_email = request.form("mem_email")
mem_first = request.form("mem_first")
mem_last = request.form("mem_last")
mem_ezine = request.form("mem_ezine")

Select Case sub_amount

Case "31.50"
sub_term = "One Year"
mem_status = "Current"
start_date = end_date + 1
end_date = start_date + 365

Case "53.00"
sub_term = "Two Years"
mem_status = "Current"
start_date = end_date + 1
end_date = start_date + 730

End Select
%>

********************

the error message.

********************
Error Type:
Microsoft VBScript runtime (0x800A000D)
Type mismatch: '[string: "7/22/2003"]'
/powerquotes_plus/Connections/subscriptions.asp, line 14
********************

Question:

How do I convert the string date (end_date) to a format that I can
work with?

Thanks

Brett
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,767
Messages
2,569,572
Members
45,046
Latest member
Gavizuho

Latest Threads

Top