DateTimeParseException: Unable to obtain LocalDateTime from TemporalAccessor

Dec 27, 2019

You can't parse a date string into LocalDateTime without a time.

LocalDateTime.parse("2019-10-25", DateTimeFormatter.ofPattern("yyyy-MM-dd"))

You should parse the string into LocalDate and call LocalDate.atStartOfDay() to return LocalDateTime with time 00:00:00.

LocalDate.parse("2019-10-25", DateTimeFormatter.ofPattern("yyyy-MM-dd")).atStartOfDay()

❤️ Is this article helpful?

Buy me a coffee ☕ or support my work via PayPal to keep this space 🖖 and ad-free.

Do send some 💖 to @d_luaz or share this article.

✨ By Desmond Lua

A dream boy who enjoys making apps, travelling and making youtube videos. Follow me on @d_luaz

👶 Apps I built

Travelopy - discover travel places in Malaysia, Singapore, Taiwan, Japan.