The reason is that parsing is case sensitive by default and the formatter doesn't recognize "jan"
. It would only recognize "Jan"
.
You can construct a case-insensitive parser by using a DateTimeFormatterBuilder and calling parseCaseInsensitive():
Changes the parse style to be case insensitive for the remainder of the formatter.
Parsing can be case sensitive or insensitive - by default it is case sensitive. This method allows the case sensitivity setting of parsing to be changed.
DateTimeFormatter dTF =
new DateTimeFormatterBuilder().parseCaseInsensitive()
.appendPattern("dd-MMM-yyyy")
.toFormatter();