LocalDateTimeの解析時にTemporalAccessorからLocalDateTimeを取得できない(Java 8)
Java 8で日付文字列をDateTimeオブジェクトに変換しようとしています。次の行を実行すると、 DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMdd"); LocalDateTime dt = LocalDateTime.parse("20140218", formatter); 次のエラーが発生します。 Exception in thread "main" java.time.format.DateTimeParseException: Text '20140218' could not be parsed: Unable to obtain LocalDateTime from TemporalAccessor: {},ISO resolved to 2014-02-18 of type java.time.format.Parsed at java.time.format.DateTimeFormatter.createError(DateTimeFormatter.java:1918) at java.time.format.DateTimeFormatter.parse(DateTimeFormatter.java:1853) at java.time.LocalDateTime.parse(LocalDateTime.java:492) 構文はここで提案されているものと同じですが、例外があります。使用していJDK-8u25ます。