How to convert string to dateTimePicker format in C#?
<p>I am fetching data from database in datatable's object called <code>dt</code>. I want to convert that string in to <code>dateTimePicker</code>'s format.</p>

<p>I have tried this code but its not working .</p>

<pre><code>dtpPlanDate.Value = DateTime.ParseExact(dt.Rows[0]["PlanSDate"].ToString(), "yyyy-MM-dd HH:mm:ss,fff", System.Globalization.CultureInfo.InvariantCulture);
</code></pre>

<p>it gives me this error </p>

<blockquote>
  <p>String was not recognized as a valid DateTime</p>
</blockquote>

<p>I also tried another format:</p>

<pre><code>dtpPlanDate.Value = Convert.ToDateTime(dt.Rows[0]["PlanSDate"].ToString());
</code></pre>

<p>it gives me error</p>

<blockquote>
  <p>Could not determine the order of year, month, and date from
  'mm/dd/yyyy'.</p>
</blockquote>

<p>I also tried one more format </p>

<pre><code>dtpPlanDate.Value =DateTime.Parse(dt.Rows[0]["PlanSDate"].ToString());
</code></pre>

<p>it gives me below error</p>

<blockquote>
  <p>Could not determine the order of year, month, and date from
  'mm/dd/yyyy'.</p>
</blockquote>

<p>please let me know right format </p>
