Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 ASP.NET
 Date from ASP form to SQL database (I lost my day)

Author  Topic 

e.bar
Starting Member

25 Posts

Posted - 2003-03-27 : 19:10:12
Hi!

I have an ASP form with a field in dd/mm/yyyy format. When I try to insert a value in the SQL I need to type it in mm/dd/yyyy format, otherwise I receive an error message. What I need to SQL accept dd/mm/yyyy type submission from a ASP form? I lost the whole day on it!

Tks.

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2003-03-27 : 19:15:36
I think that what you want to do is CONVERT it. Have a look at CONVERT in BOL. What you want to look at is the style option. You will need to CONVERT it to style 101, which is the US format.

Tara
Go to Top of Page

SamC
White Water Yakist

3467 Posts

Posted - 2003-03-27 : 21:06:38
You should validate the date in ASP before sending it to the stored procedure.

IF IsDate(strMyDate) Then ' Valid date! ( to ASP anyway )

End If

You didn't say if you're using stored procedures or not. There are a few other ways to convert a date string into datetime format depending on your method.

Sam

Go to Top of Page
   

- Advertisement -