title: Parsing date - yyyy-dd-mm hh:mm:ss
body: <p>I have a date string which is as follows: </p>
  
  <blockquote>
    <p>2015-12-24 08:06:44</p>
  </blockquote>
  
  <p>Now I have a parse function: </p>
  
  <pre><code>public static String parseDate(String date) {
          Date oldDate = null;
          try {
              System.out.println("Unparsed: "+date);
              DateFormat oldFormat = new SimpleDateFormat("yyyy-mm-dd hh:mm:ss");
              oldDate = oldFormat.parse(date);
              System.out.println("old Date parsed: "+oldDate);
              DateFormat newFormat = new SimpleDateFormat("yyyy-mm-dd", Locale.ENGLISH);
              Date result = newFormat.parse(oldDate.toString());
  
              return result.toString();
  
          } catch (Exception e) {
              e.printStackTrace();
          }
          return null;
      }
  </code></pre>
  
  <p>The first System.out gives me: </p>
  
  <blockquote>
    <p>Unparsed: 2015-12-24 08:06:44</p>
  </blockquote>
  
  <p>The second one: </p>
  
  <blockquote>
    <p>Sat Jan 24 08:06:44 GMT+05:30 2015</p>
  </blockquote>
  
  <p>Whereas for the second one I have clearly mentioned the date format to be  as:</p>
  
  <pre><code>new SimpleDateFormat("yyyy-mm-dd hh:mm:ss");
  </code></pre>
  
  <p>Please advise on what's wrong here</p>
  
  <p>I only want to get the month and day from the input string - Desired would be <code>Dec 24</code> from the above sample date string. </p>