October 6, 2008 at 1:53 pm
I'm using the Date() and Time() Functions from Classic ASP (Haven't upgraded this particular site to .NET yet) and passing them into a stored procedure. This gives me a string in this format:
DECLARE @SubmitDate varchar(30)
SET @SubmitDate = '10/6/2008_2:37:33 PM'
I'm trying to convert this into a valid SQL datetime including seconds. Every conversion I've gotten to work thus far has either dropped the seconds, or required crazy string manipulation with multiple replaces and left/right/substrings.
Anyone know how I can end up with something like: 2008-10-06 02:37:33.000 without ripping the string all apart?
Thanks,
October 6, 2008 at 2:22 pm
Why do you have an "_" between the date and time? If you pass the string without the underscore and have the stored procedure parameter defined as datetime then it should work with the implicit conversion from string to datetime.
Jack Corbett
Consultant - Straight Path Solutions
Check out these links on how to get faster and more accurate answers:
Forum Etiquette: How to post data/code on a forum to get the best help
Need an Answer? Actually, No ... You Need a Question
October 6, 2008 at 2:45 pm
Indeed it does. I was using the _ to ensure that nothing wacky happened with the Querystring, but SQL handles the %20 just fine. Thanks Jack.
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply