title: SimpleDateFormat returns incorrect date
body: <p>I ran the below code and got ambiguous result:</p>
  
  <pre><code>    import java.text.SimpleDateFormat;
      import java.util.Date;
      import java.text.DateFormat;
      import java.text.ParseException;
  
      public class Test
      { 
          public static void main(String[] args)
          {
               DateFormat format = new SimpleDateFormat("yyyyMMdd");
               DateFormat secFormat = new SimpleDateFormat("ddMMYYYY"); 
               String date = "20171231";
               try {
                        Date newDate = format.parse(date);
                        System.out.println("Normal: "+newDate);          
                        System.out.println("Actual: 
                          "+secFormat.format(newDate));
                   } catch (ParseException ex) {
               System.out.println("Exception");
              }        
           }
         }
  </code></pre>
  
  <p>The above result I got is as below:
  Normal: Sun Dec 31 00:00:00 UTC 2017
  Actual: 31122018</p>
  
  <p>31122018 is returned when the value is 31122017. Can anyone help me in getting the correct result as its a requirement in my project.</p>