Please! I would like to understand why this simple LocalDate parsing isn't working!
My DateFormatter works (in both ways), but when I'm trying to parse into a new LocalDate variable (using the same Formatter), it doesn't work and I get the following exception.
DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("MMM-dd-yyyy");
LocalDate date = LocalDate.now();
String dateFormatted = date.format(dateTimeFormatter);
System.out.println("Data formatted > " + dateFormatted);
String dateFormatted1 = dateTimeFormatter.format(date);
System.out.println("Data formatted 2> " + dateFormatted1);
LocalDate dateParsed = LocalDate.parse(dateTimeFormatter.format(date));
System.out.println("Data parsed > " + dateParsed);
LocalDate dateParsed2 = LocalDate.parse(dateFormatted, dateTimeFormatter);
System.out.println("Data parsed 2 > " + dateParsed2);
/////////////////////// Exception //////////////////////////////
Caused by: java.time.format.DateTimeParseException: Text 'dez-11-2017' could not be parsed at index 0
at java.time.format.DateTimeFormatter.parseResolved0(DateTimeFormatter.java:1949)
at java.time.format.DateTimeFormatter.parse(DateTimeFormatter.java:1851)
at java.time.LocalDate.parse(LocalDate.java:400)
at java.time.LocalDate.parse(LocalDate.java:385)
at hypercaos.AddController.initialize(AddController.java:74)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2548)*