andycharger Posted January 29, 2004 Posted January 29, 2004 I have a string from a textbox (request.form("date")) Now I want to format that into a date format. Reason I ask is when im preparing it for my SQL statement im doing this: strDate = "# " & request.form("date") & " #" This gives me "# 01/02/2004/ #" However, it has problems gewtting into SQL Server like this. It seems to want it like this: # 01 / 02 / 2004 # and not all closed up. How can I format my string so that SQL server will take it? Quote
andycharger Posted January 29, 2004 Author Posted January 29, 2004 Ignore the extra / Its a mistake! I was trying to demonstrate the date all closed up!!!! Quote
*Gurus* Derek Stone Posted January 29, 2004 *Gurus* Posted January 29, 2004 Leave off the pound signs and format the date, as it appears you are doing, as "mm/dd/yyyy". Microsoft SQL Server does parse dates in the same fashion as Microsoft Access. Quote Posting Guidelines
andycharger Posted January 30, 2004 Author Posted January 30, 2004 Formatting Ok, so if I want to format the request.form("date") string into a valid date style (i.e. dd/mm/yyyy). so how would I do that? Is it something like: FormatDate(request.form("date")), dd/mm/yyyy) Quote
bungpeng Posted January 30, 2004 Posted January 30, 2004 You should convert the String to Date format first, before format it to dd/mm/yyyy: Format(myDate, "dd/MM/yyyy") Quote
*Gurus* Derek Stone Posted January 30, 2004 *Gurus* Posted January 30, 2004 I wouldn't suggest either one of those solutions as they assume the date is in a particular format. Try the solution I posted in this thread instead. Quote Posting Guidelines
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.