Creating DateTime from two FormCollection data strings
<p>In my <code>FormCollection</code> data I have two fields I need to combined into a <code>DateTime</code> filed. The Date is contained in <code>SlectedStartDay</code> in the format of <code>dd/MM/yyyy 12:00:00 AM</code> (the time never changes just the date) and the time is contained in <code>StartTime</code> in the format of <code>h:mm:ss tt</code>. I need to combine the two into a single <code>DateTime</code> variable but can not figure out how to do it since I am working form a <code>FormCollection</code>.</p>

<p>I have tried both <code>DateTime.Parse</code> as well as <code>Convert.ToDateTime</code> but each gives me the error "String was not recognized as a valid DateTime". What is the right way to do this conversion?</p>

<pre><code>private string AddTimesheet(FormCollection postData)
{
    var startDates = postData["SelectedStartDay"].Split(',');
    var startDateTime = DateTime.Parse(startDates[0] + postData["StartTime"]);
    return "";
}
</code></pre>