title: Java change date format from custom date to MM dd yyyy
body: <p>I am trying to convert a String value that is stored in a database,for example "2012-01-20",  to be in the format January 20, 2012.</p>
  
  <p>I have seen some examples, but they are using <code>Date</code> which works with <code>SimpleDateFormat</code>.</p>
  
  <p>As an example here is one way I tried but the "try" always fails and the result is null</p>
  
  <pre><code>DateFormat df = new SimpleDateFormat("MM/dd/yyyy");
  Date convertedDate=null;
  
  try {
  
      convertedDate = df.parse(datePlayed);                   
  
  } catch(ParseException e){
      e.printStackTrace();
  }   
  </code></pre>