473,568 Members | 2,935 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

working with dates

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_am ount")
end_date = request("end_da te")
mem_email = request.form("m em_email")
mem_first = request.form("m em_first")
mem_last = request.form("m em_last")
mem_ezine = request.form("m em_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_plu s/Connections/subscriptions.a sp, line 14
*************** *****

Question:

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

Thanks

Brett

Jul 19 '05 #1
2 1897
Use CDate to convert the string to date.

HTH,
Bob Barrows

Brett Atkin wrote:
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_am ount")
end_date = request("end_da te")
mem_email = request.form("m em_email")
mem_first = request.form("m em_first")
mem_last = request.form("m em_last")
mem_ezine = request.form("m em_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_plu s/Connections/subscriptions.a sp, line 14
*************** *****

Question:

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

Thanks

Brett

Jul 19 '05 #2
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" <re*******@yaho o.com> wrote in message
news:eW******** ******@tk2msftn gp13.phx.gbl...
Use CDate to convert the string to date.

HTH,
Bob Barrows

Brett Atkin wrote:
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_am ount")
end_date = request("end_da te")
mem_email = request.form("m em_email")
mem_first = request.form("m em_first")
mem_last = request.form("m em_last")
mem_ezine = request.form("m em_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_plu s/Connections/subscriptions.a sp, line 14
*************** *****

Question:

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

Thanks

Brett


Jul 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
3319
by: Mad | last post by:
Hello to all. I have been trying to work with dates on Visual Basic Version 3. Using a Textbox (Text1.text) I understand that "Format" is use to display the date as you like. But what type of input it needs? What is a date format?
2
4981
by: wireless200 | last post by:
I've got a table with some datetime fields in it. One field (call it field 1) is of the form mm/dd/yyyy and the other two (fields 2 and 3) are in the form of hh:mm:ss:xx where xx is hundreths of a second. I'm getting the difference between field 2 and 3 using (datediff(ms, access_time, release_time )/1000/60.). This seems to work fine. ...
5
11363
by: tshad | last post by:
I have a date validation function that I want to stay at the object I am validating if there is a Validation error, but it always goes to the next object. The Javascript: function ValidateForm(me){ var dt=me if (isDate(dt.value)==false){ dt.focus()
5
14878
by: BlackFireNova | last post by:
I need to write a report in which one part shows a count of how many total records fall within the working days (Monday - Friday) inside of a (prompted) given date range, in a particular geographical region. I have written a query which prompts the user for the start and end dates. It also filters for entries which pertain to the particular...
3
3099
by: | last post by:
Hello, I am hoping someone else has thought about a date time calculation i need to perform. I would like to be able to calculate the number of "working minutes" between 2 dates, given my working week definition. Lets say I have a working week definition of Monday through Friday, 9 am to 5 pm. Date1 = January 1st, 2005 at 8 am
3
7717
by: Jason Huang | last post by:
Hi, In our C# Windows Form application, we are using the SQL Server 2000 as the database server. The Database table MyTable has a field RegistrationDate which represents the Date a client comes to our company to deliver his product. We have some Working days for processing his product, like 20, 30, 40 days. My question is how do I handle...
12
3154
by: jonathan184 | last post by:
Hi the purpose of the script I am trying to do is to access a dir and run the ls -l command which will show the files and the modified date, no w the script is to check two files in that dir , if the file has the modified month and day matching today print message log is fine else the log is not updated and thats it. Now the script below I...
11
2630
by: lenygold via DBMonster.com | last post by:
Hi everybody! This query is supposed to count consecutive years from the current year without OLAP. Input Table: ID DateCol 1 02/01/2006 1 01/01/2006 1 01/01/2005
6
2028
by: Mike Copeland | last post by:
I am working with a file of data that contains "time values" (e.g. "1225365563"), and I want to convert this data into something I can use in a program I'm developing. From what I've read about time_t, it seems this value, if converted from its string format, would be a date/time value - if I could convert it. I find no conversion function...
2
2783
by: angi35 | last post by:
Hi, I'm working in Access 2000. I have a form with a series of date fields, showing the progress of a project from start to completion. There's a set of fields/controls for projected dates (when the project is projected to enter each stage of the process) and another set for actual dates. For my purposes, I'm only working with the projected...
0
7605
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7917
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7665
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6277
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5501
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3651
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3631
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2105
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
933
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.