title: DateTime from C# to MySQL: incomplete storage
body: <p>I am working with <code>DateTime</code> objects to create a monitoring application.
  The principle is that each time a user launches a specific application, the current date and time will be saved in the DB. Then in the monitoring app, I get this date field from DB and display it.</p>
  
  <p>As I went through testing today, I tried to launch the app : <code>DateTime.Now</code> is stored (ie, in French culture, 22/04/11 17:09:50 ).
  When I launch the monitoring app, what I get from the database is 22/04/11 00:00:00
  Is there any reason why the exact time isn't saved?</p>
  
  <p>The column in DB is, of course, a Date column.</p>
  
  <p>Some code:</p>
  
  <p>Storing the date:</p>
  
  <pre><code>                command = new MySqlCommand(_updateDateCommand, connection);
                  command.Parameters.AddWithValue("?Template", app);
                  command.Parameters.AddWithValue("?Date", DateTime.Now);
                  command.Parameters.AddWithValue("?Id", u.Id);
  
  
                  if (command.ExecuteNonQuery() != 0) return true;
  </code></pre>
  
  <p>Retrieving the data:</p>
  
  <pre><code>                object date = reader.GetValue(4);
                  if (date == System.DBNull.Value)
                  {
                      tempUserApp.DateLastUsed = DateTime.MinValue;
                  }
                  else
                  {
                      tempUserApp.DateLastUsed = (DateTime)date;
                  }
  </code></pre>
  
  <p>I'm sure that the problem comes from the storing process, because visualizing data with a tool such as Toad show me <code>22/04/11 00:00:00</code> in the Date field.</p>
  
  <p>Update command:</p>
  
  <pre><code>private readonly string _updateDateCommand =
              "UPDATE userapplications " +
              "JOIN template t ON t.Name = ?Template " +
              "SET DateUsed=?Date  WHERE `User Id`=?Id AND `Template Id`=t.Id";
  </code></pre>
  
  <p>Is there any special formatting for MySQL dates?</p>
  
  <p>I bumped into <a href="https://stackoverflow.com/questions/3633262/convert-datetime-for-mysql-using-c">this StackOverflow question</a> and tried the solution proposed, it does not work either</p>
  
  <p>Any idea?</p>