org.threeten.bp.format.DateTimeParseException: Text could not be parsed at index [closed]
Asked Answered
S

0

7

I'm receiving the date in the below format:

"Deadline": "2019-07-05T16:30:00"

And I'm trying to parse it using below formatter:

private val formatter: DateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss", Locale.ENGLISH)

But I'm getting the following exception:

org.threeten.bp.format.DateTimeParseException: Text '2019-05-21T12:30:00' could not be parsed at index 19

Note: i'm using ThreeTenABP library

Schappe answered 9/8, 2019 at 10:40 Comment(6)
Looks like a bug in the library.Locust
it is working for with java date timeGreece
Weird. Index 19 is the end of the string. Could there be some non-printing character at the end of your format pattern string? BTW you don’t need to declare your own formatter for this string. Just use the built-in DateTimeFormatter.ISO_LOCAL_DATE_TIME.Ault
@OleV.V. I've checked it.There isn't any character at the end of my format pattern string.Schappe
I cannot reproduce. Using jdk1.7.0_67, threetenbp-1.3.6 and your formatter I tried LocalDateTime.parse("2019-05-21T12:30:00", formatter). It gave the expected result and no exception. Could you create a Minimal, Reproducible Example, please?Ault
@OleV.V. The issue was from backend part the time format wasn't same but now it's fixed. Thanks for your time.Schappe

© 2022 - 2024 — McMap. All rights reserved.