Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Oct 21, 2008 03:58 PM by lmcculloch
Oct 21, 2008 01:41 PM|LINK
I am usig Calender extender control to select date.it works fine but the issue is while storing in SQL table the date is stored with Defaulttime like below:
"10/7/2008 12:00:00 AM".My Requirement is like if a customer calling yesterday 10.30AM .Today I am entering the Customer calldetails date " 20-10-08 " with time 10:30AM it has to be stored like 20-10-08 :10.30AM.I want to know the
1)Is there any control to select Date and Time simultaneously.
2)How to Enter the Date and Time in Storedprocedure.(Here the Time meant not default time but user defined time like 10:30AM.plz kindly let me know its very urgent.
ASP.NET 2.0 - Ajax
Oct 21, 2008 03:29 PM|LINK
You've to format the value returned by sql server on the front end, alternatively you could set the datatype of that column to varchar, however, it is not at all the preferred way of doing away with this problem but may fastly come to your rescue [:$]
Oct 21, 2008 03:58 PM|LINK
This way works, but there may be more efficient ways to handle it depending on when/where you are handling the values. This assumes you have the saved date as a datetime SQL type and the time portion is sent in to a stored procedure as a varchar.
-- use AM/PM
-- set @time = ' 02:45:00 PM'
-- use 24 hour clock
-- concatenate the date and time values by converting the date to a varchar
-- then adding the time portion, then casting the new string to a single datetime value
-- using convert code 101 ensures any existing time portion from the saved date will not
-- be included