Code: Select all
public LocalDate parseDate(String date) {
return LocalDate.parse(date, DateTimeFormatter.ofPattern("MM-yyyy"));
}
< /code>
Aber dieser Code wirft eine Ausnahme < /p>
ausjava.time.DateTimeException: Unable to obtain LocalDate from TemporalAccessor: {MonthOfYear=5, Year=2022},ISO of type java.time.format.Parsed