title: How to store current Date and time in mysql
body: <p>I have a java program where I used java.util.Date to fetch current date and time and I have a table in mysql having a field as</p>
  
  <pre><code>ActivityTime date; // date is the type
  </code></pre>
  
  <p>And I used prepared statement to insert in the table.</p>
  
  <pre><code>java.util.Date today = new java.util.Date();
  long t = today.getTime();
  
  PreparedStatement ps = con.prepareStatement(
                  "insert into UserActivity values (?, ?, ?, ?, ?, ?)");
  ....
  ps.setDate(5, new java.sql.Date(t));
  ....
  </code></pre>
  
  <p>Date is shown correct in output but time is 00:00:00 I don't know why is this happening ?
  Please help me to fetch time also. 
  When I printed java.util.date is shows correct time. Problem is how to insert time into sql table. </p>
  
  <p>PS: May be this is very simple but java api is new to me</p>