我尝试使用LocalDateTime和DateTimeFormatter并尝试解析此字符串:
2020-04-28 and time: 12:37:49.863
但是抛出DateTimeParseException
这是代码片段:
String line = "2020-04-28 and time: 12:37:49.863";
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd 'and time: 'hh:mm:ss.SSS");
LocalDateTime localDateTime = LocalDateTime.parse(line, formatter);
为什么会发生?