title: JDBC: Inserting Date values into MySQL
body: <p>I would like to know how to set Date values to MySQL database, using Java JDBC. Following is my code.</p>
  
  <pre><code> String lastCrawlDate = "2014-01-28"
   PreparedStatement p = con.prepareStatement("insert into JsonData (last_crawl_date) values(?))");
  
   p.setDate(1, Date.valueOf(lastCrawlDate));
  </code></pre>
  
  <p>As you can see, the <code>lastCrawlDate</code> is a <code>String</code> and in the format of <code>yyyy/mm/dd</code>.</p>
  
  <p>Following is how my table looks like and how the <code>Date</code> field is defined.</p>
  
  <p><img src="https://i.stack.imgur.com/bwvSB.png" alt="enter image description here"></p>
  
  <p>How can I do this?</p>