java.time.format.DateTimeParseException: Text '31/12/2024' could not be parsed at index 2
A java.time parse call got text that doesn’t match the expected format.
Seen on:
Java
Meaning
LocalDate.parse() expects ISO format (2024-12-31) unless you pass a DateTimeFormatter. The index points to the first mismatching character.
Common causes
- Non-ISO input without a formatter
- Wrong pattern letters (MM vs mm, yyyy vs uuuu)
- Locale-specific month names
- Time zone suffix not in pattern
⚡ Quick fix
- Use a formatter: DateTimeFormatter.ofPattern("dd/MM/yyyy")
- Prefer ISO strings in APIs
- Use OffsetDateTime for zone offsets
Detailed fix by platform
Java
LocalDate d = LocalDate.parse("31/12/2024", DateTimeFormatter.ofPattern("dd/MM/yyyy"));
How to diagnose
- Text — Which string and index?
- Pattern — Matches the input?
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
Was this page helpful?
Report a correction or suggest an improvement
Last updated 2 Oct 2026