title: String to Date in a PreparedStatement
body: <p>I am trying to use setDate() in a PreparedStatement, however the date that I have is in the format of 2008-07-31. The code is:</p>
  
  <pre><code> pstmt.setDate(f++, (Date) DateFormat.getDateInstance(DateFormat.DEFAULT).parse(value.substring(0, 10)));
  </code></pre>
  
  <p>However, it gives me the error:</p>
  
  <pre><code>Exception in thread "main" java.text.ParseException: Unparseable date: "2008-07-31"
  </code></pre>
  
  <p>Why is this?</p>