8

次のような日付文字列を解析したい2011-11-30:

LocalDateTime.parse("2011-11-30", DateTimeFormatter.ISO_LOCAL_DATE)

しかし、次の例外が発生します。

java.time.format.DateTimeParseException: Text '2011-11-30' could not be parsed:
Unable to obtain LocalDateTime from TemporalAccessor

日付時刻の文字列を渡すと、すべてが期待どおりに機能します。

LocalDateTime.parse("2011-11-30T23:59:59", DateTimeFormatter.ISO_LOCAL_DATE_TIME)

2011-11-30LocalDateTime のような日付を (デフォルトの時刻で) 解析するにはどうすればよいですか?

4

3 に答える 3