Wrox Programmer Forums
|
Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 20th, 2005, 04:18 AM
Registered User
 
Join Date: Aug 2005
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default String to DateTIme for Insert

HI All

I have a form which asks users for a date and time with a series of drop downs, ( this date and time will be in the future so i dont want to use NOW)

What I do is take the form values from the post data and build a string which is the date and time in this format

12/01/2005 09:55:00

with this string i then do an insert, however the data type is causing problems, as I am trying to pass a string into a stored proc to insert the value into a field with datatype DateTime.

What is the best way to get this into a format which I will be able to insert into my DateTime field.

Changing the data type of this field in my DB is not an option.

platform: ASP & SQL server 2000

Many Thanks




 
Old August 21st, 2005, 11:09 PM
Authorized User
 
Join Date: Jan 2005
Posts: 36
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to askenkray
Default

I suppose that 12/01/2005 09:55:00 is the format that u have in ASP.
But when u want to add it to database,then you have to conver it into the format that is required by the database(Here:SQL Server)

just use convert(datetime,'12/01/2005 09:55:00') in the sql insert query.

It will work.



Ashwin S.Kenkare
Programmer
CMI





Similar Threads
Thread Thread Starter Forum Replies Last Post
Convert String to DateTime SimoNWellborne C# 3 October 11th, 2014 02:24 AM
String was not recognized as valid datetime thillaiarasu Visual Studio 2005 2 November 2nd, 2007 05:19 AM
How to convert a string in DateTime elena SQL Language 6 March 29th, 2006 06:59 PM
Convert string to datetime nkovacevic General .NET 4 April 5th, 2005 11:57 AM
How to convert a string in DateTime elena ADO.NET 3 July 24th, 2003 04:31 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.