0

the following code does not work: (take care that the string containing the date is localized)

DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd-MMM-yy", new Locale("es")); 
LocalDate parse = LocalDate.parse("13-DIC-16", formatter);  

I get:

java.time.format.DateTimeParseException: Text '13-DIC-16' could not be parsed at index 3

What does "index 3" mean?

How to parse with java 8 dates in the format dd-MMM-yy (using the correct locale)?

I cannot modify the original query which provides the strings.

mrtexaz
  • 663
  • 7
  • 22
  • 3
    The problem comes from the fact that the API is case sensitive; a case-insensitive parser must be built, see the linked question. `"DIC"` cannot be parsed (`'D'` is the index 3 at `'13-DIC-16'`). – Tunaki Jan 11 '17 at 10:48
  • Thanks! That is the issue, now it works. – mrtexaz Jan 11 '17 at 10:50

0 Answers0