|
-
Mar 21st, 2001, 06:21 AM
#1
Thread Starter
New Member
Hi,
I'm trying to add a date (user specified) to my SQL server using an ASP page with drop down menus to select day, month and a text with 2 characters for year.
Then I have a string to put them together as one variable and I am trying to use the function fromatdatetime to get the date into a valid format for the db (using datetime datatype).
My problem lies in how to split up the date terms. If i use forward slash it divides the numbers and if i use colons or full stops it displays as time.
I've seen this method of collecting date info millions of times on other web pages but I can't get it to work.
my code:
dim start
dim startd
start = Request.Form ("startd") & "." & Request.Form ("startm") & "." & Request.Form ("starty")
startd = FormatDateTime(start,3)
where startd is an optionbox for day, startm an option for month and starty a 2 character textbox for year.
Thanks for any advice
-
Mar 21st, 2001, 07:12 AM
#2
Thread Starter
New Member
I've also tried stuff with single quotes ie:
start = "'" & Request.Form ("startd") & "." & Request.Form ("startm") & "." & Request.Form ("starty") & "'"
didn't work like this, with or without the formatdatetime function.
any other ideas?
-
Mar 21st, 2001, 12:45 PM
#3
Addicted Member
Have you tried...
Code:
StartDate = Request("startd") & "/" & Request("startm") & "/" & Request("starty")
??????
PS: the .form dont matter, I was just lazy
-
Mar 22nd, 2001, 04:18 AM
#4
Thread Starter
New Member
yeah I tried that but the "/" character meant that the numeric values entered for the dates all divided themselves into each other.
I have fixed it now by using ascii code to represent the "/" ie:
startdate = Request.Form ("startm") & chr(47) & Request.Form ("startd") & chr(47) & Request.Form ("starty")
This works but is a bit of a work round rather than pure solution.
Thanks for your input though,
George
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|