title: mysql: finding groups of records within a specified time period in Java
body: <p>I want to link the mysql database using Java, execute query returns the record of the specified period, and finally present the result in form of table in java.
  How can I convert the input string into the mysql valid date and output the result?
  I tried this, but failed.</p>
  
  <pre><code>Connection con = DBCon.dbcon();
  java.util.Date t1= new SimpleDateFormat("yyyyMMdd").parse(jTextField2.getText());
  java.util.Date t2= new SimpleDateFormat("yyyyMMdd").parse(jTextField3.getText());
  
  PreparedStatement query = con.prepareStatement(SELECT * FROM transaction WHERE TransactionDate &gt;= ？ and TransactionDate &lt;=  '"+t1+"' and id1=?);
  
  ResultSet rs = query.executeQuery();
  </code></pre>
  
  <p>Thank you very much!!!</p>
  
  <p><a href="https://i.stack.imgur.com/eieks.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/eieks.jpg" alt="enter image description here"></a></p>