Linked Questions

Popular Questions

I'm trying to convert String to timestamp, but getting a parse error for date pattern.

String timeString= "22/10/18 - 3:05pm";
DateTimeFormatter format = DateTimeFormatter.ofPattern("dd/mm/yy - h:mma", Locale.ENGLISH);
LocalDateTime datetime = LocalDateTime.parse(timeString, format);
Timestamp timestamp = Timestamp.valueOf(datetime);

Exception in thread "main" java.time.format.DateTimeParseException: Text '22/10/18 - 3:05pm' could not be parsed at index 13

Related Questions