title: How to insert current date into MySQL database use Java?
body: <p>I want to insert the current date and time into a columns defined as datetime type.</p>
  
  <p>I typed the following code:</p>
  
  <pre><code>java.sql.Date sqlDate = new java.sql.Date(new java.util.Date().getTime());
  PrepStmt.setDate(1, sqlDate);
  </code></pre>
  
  <p>When I check the database, I find that the date inserted correctly, but the time is: 00:00:00. What is the fix ?</p>