title: Can't make java.text.SimpleDateFormat to work
body: <p>I have a Date object as follows: </p>
  
  <pre><code>java.util.Date d = new java.util.Date(System.currentTimeMillis()); // Mon Dec 23 14:57:28 PST 2013
  </code></pre>
  
  <p>I need to format the date to get another Date object with this format instead: 
  2013-12-23 14:57:28</p>
  
  <p>I tried this code:</p>
  
  <pre><code>SimpleDateFormat sdf = new SimpleDateFormat("yyyy-mm-dd HH:mm:ss");
  sdf.format(d); // d is still Mon Dec 23 14:57:28 PST 2013, no formatting.
  </code></pre>
  
  <p>I tried this code:</p>
  
  <pre><code>String s = d.toString();
  try {           
          d = sdf.parse(s);
      } catch (Exception e) 
          e.printStackTrace(); // java.text.ParseException: Unparseable date: "Mon Dec 23 14:35:48 PST 2013"
  </code></pre>
  
  <p>Would you please tell me what am I doing wrong? I googled searched it but the solutions to format a Date was more or less what I tried. Any help is greatly appreciated.</p>