title: NHibernate DateTime millisecond precision
body: <p>I am having trouble with millisecond precision using NHibernate with Mysql, in my C# application.</p>
  
  <p>I want to store a <code>DateTime</code> variable in a Mysql database using Nhibernate.
  I have created a date column using the following:</p>
  
  <p><code>Date DATETIME(6) NOT NULL</code></p>
  
  <p>NHibernate's documentation has the following mapping for the column:</p>
  
  <p><code>&lt;property name="Date" column="Date" type="Timestamp"/&gt;</code></p>
  
  <p>Using <code>type="Timestamp"</code> should give me what I require, however I keep losing the millisecond precision</p>
  
  <p>Values in database for the Date column look like this:</p>
  
  <pre><code>'2014-06-17 19:58:58.000000'
  '2014-06-17 19:58:58.000000'
  '2014-06-17 19:58:59.000000'
  '2014-06-17 19:58:59.000000'
  </code></pre>
  
  <p>Nhibernate document type mapping:</p>
  
  <pre><code>Timestamp   System.DateTime DbType.DateTime 
  </code></pre>
  
  <p>as specific as database supports. <code>type="Timestamp"</code> must be specified.</p>
  
  <p><em>Note</em>: I have seen some similar posts for Oracle and SQL server but the solution to use 
  <code>type="Timestamp"</code> does not seem to work for me.</p>