I am trying to yyMMdd date string using the following pattern: yyMMdd and STRICT resolver as follows:
DateTimeFormatter formatter = DateTimeFormatter.ofPattern(dateFormat).withResolverStyle(ResolverStyle.STRICT); LocalDate.parse(expiryDate, formatter);
I get the following DateTimeParseException :
java.time.format.DateTimeParseException: text '160501' cannot be parsed: Failed to get LocalDate from TemporalAccessor: {YearOfEra = 2016, MonthOfYear = 5, DayOfMonth = 1}, ISO of type java.time.format.Parsed
When I go to the default resolution style, i.e. ResolverStyle.SMART , it allows dates like February 30th.
Can anybody help?
source share