Java Text x could not be parsed:Unable to obtain LocalDateTime f
问题描述:
java.time.format.DateTimeParseException: Text '2023-08-18' could not be parsed: Unable to obtain LocalDateTime from TemporalAccessor: {},ISO resolved to 2023-08-18 of type java.time.format.Parsed
问题分析:
1、不能直接把'2023-08-18'字符串转换为LocalDateTime。
解决办法:先把'2023-08-18'字符串转换为LocalDate,然后再把LocalDate转换为LocalDateTime。
注:
有关CustomDateUtil.toLocalDateTime的源代码请查看gitee的xudong_master项目的master分支。
https://gitee.com/xudong_master/xudongbase/tree/master