title: How to parse a date?
body: <p>I am trying to parse this date with <code>SimpleDateFormat</code> and it is not working:</p>
  
  <pre><code>import java.text.ParseException;
  import java.text.SimpleDateFormat;
  import java.util.Date;
  
  public class Formaterclass {
      public static void main(String[] args) throws ParseException{
          String strDate = "Thu Jun 18 20:56:02 EDT 2009";
          SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
          Date dateStr = formatter.parse(strDate);
          String formattedDate = formatter.format(dateStr);
          System.out.println("yyyy-MM-dd date is ==&gt;"+formattedDate);
          Date date1 = formatter.parse(formattedDate);
  
          formatter = new SimpleDateFormat("dd-MMM-yyyy");
          formattedDate = formatter.format(date1);
          System.out.println("dd-MMM-yyyy date is ==&gt;"+formattedDate);
      }
  }
  </code></pre>
  
  <p>If I try this code with strDate=<code>"2008-10-14"</code>, I have a positive answer. What's the problem? How can I parse this format?</p>
  
  <p>PS. I got this date from a <code>jDatePicker</code> and there is no instruction on how modify the date format I get when the user chooses a date.</p>