title: How to convert Calendar to java.sql.Date in Java?
body: <pre><code>Calendar cal;
  String sql = "INSERT INTO ttable (dt) values (?);"
  //dt is a dateTime field in ttable
  
  PreparedStatement stmt = connection.prepareStatement(sql);
  
  stmt = setDate(1,cal); //not working
  
  stmt.execute();
  stmt.close();
  </code></pre>
  
  <p>I would like to convert cal to a Date type to insert into table.</p>