欢迎光临散文网 会员登陆 & 注册

Java Text x could not be parsed:Unable to obtain LocalDateTime f

2023-08-18 16:00 作者:旭东怪  | 我要投稿

问题描述:

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

Java Text x could not be parsed:Unable to obtain LocalDateTime f的评论 (共 条)

分享到微博请遵守国家法律