Click here to Skip to main content
15,902,787 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have used ajax:calender control and take date format of dd/MM/yyyy. so when select date in ajax:calender then it display on textbox like 25/11/2013


My problem is..while taking varchar(50) datatype for inserting it into database
it's working fine. but when taking date datatype instead of varchar(50) it gives error 'string is not recognized as a valid datetime' in serverside.

Please Help me....Thanks in Advance...
Posted
Updated 27-Nov-13 22:39pm
v2

Try this:
C#
using System.Globalization;
//////////
DateTime dt = DateTime.ParseExact(yourtxtbox.Text, "dd/MM/yyyy", CultureInfo.InvariantCulture);//insert this into date field
 
Share this answer
 
v2
Have a look here: Convert mm/dd/yyyy to dd/mm/yyyy[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900