title: Date format parsing java
body: <p>I want to store today's date in the format yyyy-mm-dd. before storing I have took today's date,formatted it and again parse the formatted string to date. It gives the output date in a different format other than what I want. How can i get the date, format it in 'yyyy-mm-dd'
  and again convert it into date and want the output in the format 'yyyy-mm-dd'.Please find the below code and tell  me where I am wrong</p>
  
  <pre><code>DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
  java.util.Date date = new java.util.Date();
  java.util.Date date1;
  String datestring=dateFormat.format(date);
  
  try {           
      date1=dateFormat.parse(datestring);
      System.out.print(date1);
  } catch (ParseException ex) {
       Logger.getLogger(accordcclass.class.getName()).log(Level.SEVERE, null, ex);
  }
  </code></pre>
  
  <p>The output for the above code I get is 
  Thu Mar 07 00:00:00 GMT 2013. But I want the output as 2013-01-07</p>