我有以下代码在 Oracle JDK 10 上完美运行
public static void main(String[] args) {
final var localTime = LocalTime.parse("8:00AM", DateTimeFormatter.ofPattern("h:mma"));
System.out.println("Local time is " + localTime);
}
它输出以下...
Local time is 08:00
当我在 OpenJDK 12 上运行相同的代码时,我得到了这个......
Exception in thread "main" java.time.format.DateTimeParseException: Text '8:00AM' could not be parsed at index 4
at java.base/java.time.format.DateTimeFormatter.parseResolved0(DateTimeFormatter.java:2049)
at java.base/java.time.format.DateTimeFormatter.parse(DateTimeFormatter.java:1951)
at java.base/java.time.LocalTime.parse(LocalTime.java:463)
at com.virtualenergyservices.portal.backend.bootstrap.FacilitiesImporter.main(FacilitiesImporter.java:909)
有人有什么想法吗?