public static boolean validDate(String dateString) { return DateUtil.parse(dateString) != null; // эта строка } Here is the parse (String) method from the DateUtil class:
public static LocalDate parse(String dateString) { try { return DATE_FORMATTER.parse(dateString, LocalDate::from); } catch (DateTimeParseException e) { return null; } }