提问人:Aditya Tyagi 提问时间:8/9/2019 最后编辑:Davis BrodaAditya Tyagi 更新时间:8/9/2019 访问量:1595
org.threeten.bp.format.DateTimeParseException:无法解析索引处的文本 [已关闭]
org.threeten.bp.format.DateTimeParseException: Text could not be parsed at index [closed]
问:
我收到的日期格式如下:
“截止日期”: “2019-07-05T16:30:00”
我正在尝试使用下面的格式化程序来解析它:
private val formatter: DateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss", Locale.ENGLISH)
但是我得到以下异常:
org.threeten.bp.format.DateTimeParseException: Text '2019-05-21T12:30:00' could not be parsed at index 19
注意:我正在使用ThreeTenABP库
答: 暂无答案
评论
DateTimeFormatter.ISO_LOCAL_DATE_TIME
LocalDateTime.parse("2019-05-21T12:30:00", formatter)