Answer the question
In order to leave comments, you need to log in
Why does an error occur when converting String to LocalTime?
The following code throws an exception: Exception in thread "main" java.time.format.DateTimeParseException: Text '8:20:35' could not be parsed at index 0
val time = "8:20:35"
val localTime = LocalTime.parse(time)
val time = "8:20:35"
val formatter = DateTimeFormatter.ofPattern("HH:mm:ss", Locale.getDefault())
val localTime = LocalTime.parse(time, formatter)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question