Here is a sample input from the user:
Wed 15:00
I want to parse this into an object so I'm using a LocalDateTime
object. Here's my code:
String elem = "wed 15:00";
private static final DateTimeFormatter DATE_TIME_FORMATTER = DateTimeFormatter.ofPattern(
"E H:mm"
+ "E HH:mm");
return LocalDateTime.from(DATE_TIME_FORMATTER.parse(elem));
But I'm getting the error:
java.time.format.DateTimeParseException: Text 'wed 15:00' could not be parsed at index 0
What exactly is the error here?