title: Change date format dd-MM-yyyy to yyyy-MM-dd in Java
body: <p>I was trying to convert date string 08-12-2017 to 2017-12-08(LocalDate). Here is what I tried-</p>
  
  <pre><code>    String startDateString = "08-12-2017";
      LocalDate date = LocalDate.parse(startDateString);
      System.out.println(date);
  </code></pre>
  
  <p>Also tried using formatter, but getting same result, an DateTimeParseException.
  How can I get an output like 2017-12-08, without getting an exception?</p>