title: Confused on using SimpleDateFormat when converting string value
body: <p>I am trying to take a textbox field (represented by the string <code>wkCreation</code> field) and convert the data to a date field in "YYYY-MM-DD" format. This is the code I have now using <code>SimpleDateFormat</code>:</p>
  
  <pre><code>SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
  try {
      Date convertdate = format.parse(wkCreation);
      wkCreationFormat = format.format(convertdate) ;
      System.out.println("Convertdate field  = " + convertdate);
      System.out.println("Creation Format field = " + wkCreationFormat);
  } 
  catch (ParseException e) {
      e.printStackTrace();
  }
  </code></pre>
  
  <p>It seems like the only way I can get this to work if the user puts a date actually in the same format as the <code>SimpleDateFormat</code> pattern which really defeats the purpose I would think. I am trying to get something in 'mm/dd/yy' or 'mm/dd/yyyy' format to be converted to 'YYYY-MM-DD' format. What am I missing her besides common Java sense? I am thinking my define of <code>convertdate</code> is wrong but don't know</p>