C# DateTime Convert from String
<p>I am reading excel file in my C# .net web application and storing that value in Database. Ony of field in Excel is DateTime. I am storing it in string</p>

<pre><code>string tran_time = Convert.ToString(odr[5]); //tran_time is "03-11-2012 16:08:43"
</code></pre>

<p>and then convert it in in DateTime and store it in Database (SQL Server 2008)</p>

<pre><code>IFormatProvider culture = new CultureInfo("en-US", true);
DateTime dateVal = DateTime.ParseExact(tran_time, "dd-MM-yyyy HH:mm:ss", culture);
</code></pre>

<p>But the Value Being stored in Database is in format </p>

<pre><code>2012-05-11 13:40:23.000 (yyyy-mm-dd)
</code></pre>

<p>and the value in Excel is <code>05-11-2012 13:40:23 (dd-mm-yyyy)</code></p>

<p>Date &amp; Month is get replaced.</p>

<p><strong>My Question is How can i store it in Database in Format (YYYY-MM-DD HH:MM:SS:FFF)</strong> </p>
