Question: 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.

```

Answer: 
**Problem :** in your date string `4/17/2014T12:00:00` you have only single digit `Month` value (4) but in your DateFormat string you mentione double `MM`

**Solution :** you should specify single `M` instead of double `MM`

Try This:

```
DateTime dt = DateTime.ParseExact(stime, "M/dd/yyyyTHH:mm:ss", 
                              CultureInfo.InvariantCulture);

```
Pay attention your date string contains only 1 digit for month but your patters defines `MM`.  

So either use month `04` or change pattern to `M`.