Hi All,
I have a string s that is "10/29/2006". I want to convert this string to datetime format.
used the method
DateTime dt=System.Convert.ToDateTime(s);
But it is giving an error "string was not recognised as a valid datetime. Please help me out.
Problem in using the method Convert.ToDateTime(string) Please help me.
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.
Mahesh Joshi70 pointsPosted Nov 27, 2006, 9:05 PM EST
shinoy alphonse92 pointsPosted Nov 27, 2006, 10:33 PM EST
Use this code
DateTime.Parse(txtStartDate.Text).ToString("yyyy/MM/dd")
also i suggest you to chage ur system datetime settings to the above mentioned format