R
R
raury2021-11-11 21:27:06
Java
raury, 2021-11-11 21:27:06

How to convert string "23:00" to LocalDate/LocalDateTime?

I try like this:

LocalDate.parse("23:00", DateTimeFormatter.ofPattern("HH:mm"));

Gives an error message
java.time.format.DateTimeParseException: Text '23' could not be parsed: Unable to obtain LocalDate from TemporalAccessor: {},ISO resolved to 23:00 of type java.time.format.Parsed

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question