I have a string like this and I want to convert it to DateTime format(MM/dd/yyyyTHH:mm:ss). but it fails, Please let me know where I'm wrong.
Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");
string stime = "4/17/2014T12:00:00";
DateTime dt = DateTime.ParseExact(stime, "MM/dd/yyyyTHH:mm:ss", CultureInfo.InvariantCulture);
This is the code, how I'm setting this string:
string startHH = DropDownList1.SelectedItem.Text;
string startMM = DropDownList2.SelectedItem.Text;
string startSS = DropDownList3.SelectedItem.Text;
string starttime = startHH + ":" + startMM + ":" + startSS;
string stime = StartDateTextBox.Text + "T" + starttime;
Getting this exception
String was not recognized as a valid DateTime.