Here is a sample input from the user:
String elem = "wed 15:00";
private static final DateTimeFormatter DATE_TIME_FORMATTER = DateTimeFormatter.ofPattern(
+ "E HH:mm");
java.time.format.DateTimeParseException: Text 'wed 15:00' could not be parsed at index 0
This is not a valid pattern:
"E H:mm" + "E HH:mm"
Try this instead:
String elem = "Wed 15:00"; DateTimeFormatter formatter = DateTimeFormatter.ofPattern("E H:mm"); return LocalDateTime.from(LocalDate.parse(elem, formatter));
Also notice that you'll have to specify more than just the day of the week and time to parse a
LocalDateTime object, it stands to reason: we don't know what Wednesday are we talking about!