I'm trying to parse a non-standard datetime format in Java 8. I have read the javadoc for the class and AFAICT, I'm providing the format in the correct way.
System.out.println(
DateTimeFormatter.ofPattern("dd-MMM-yy HH.mm.ss", Locale.US)
.parse("02-APR-18 09.26.21"));
but I get this error:
Exception in thread "main" java.time.format.DateTimeParseException: Text '02-APR-18 09.26.21' could not be parsed at index 3
at java.base/java.time.format.DateTimeFormatter.parseResolved0(DateTimeFormatter.java:1988)
at java.base/java.time.format.DateTimeFormatter.parse(DateTimeFormatter.java:1816)
I have also tried with removing the Locale.US but get exactly the same error message.
Any help would be appreciated.