string stringdate,sdate;
stringdate=dt.Rows[i]["Date"].ToString();
sdate = stringdate.Substring(0, 10);
//sdate='6/8/2014'
DateTime dtime=new DateTime();
dtime = DateTime.ParseExact(sdate, "M/d/yyyy", null);
MessageBox.Show(dtime.ToString());
In above code, there is an error although I convert string to correct date format. plz help me

VulpesPosted Jul 24, 2014, 1:31 PM
sdate = stringdate.Substring(0, 10);
because in this particular case DateTime.ParseExact is expecting 8 characters, not 10.
What is the date format within the DataTable?