Files

31 lines
1.4 KiB
Plaintext

== 31 February under three resolver styles (pattern dd-MM-uuuu) ==
STRICT DateTimeParseException: Text '31-02-2026' could not be parsed: Invalid date 'FEBRUARY 31'
SMART 2026-02-28
LENIENT 2026-03-03
== 30 February and 32 January ==
SMART 30-02-2026 2026-02-28
SMART 32-01-2026 DateTimeParseException: Text '32-01-2026' could not be parsed: Invalid value for DayOfMonth (valid values 1 - 28/31): 32
== STRICT with yyyy: year-of-era needs an era, so it cannot resolve ==
yyyy DateTimeParseException: Text '14-11-2026' could not be parsed: Unable to obtain LocalDate from TemporalAccessor: {MonthOfYear=11, DayOfMonth=14, YearOfEra=2026},ISO of type java.time.format.Parsed
uuuu 2026-11-14
== how many digits? MM wants two, M accepts one or two ==
yyyy-MM-dd 2026-1-5 DateTimeParseException: Text '2026-1-5' could not be parsed at index 5
yyyy-M-d 2026-1-5 2026-01-05
yyyy-M-d 2026-01-05 2026-01-05
== two-digit years are read as 2000-2099 ==
01-01-30 -> 2030-01-01
01-01-99 -> 2099-01-01
== month names are case-sensitive unless you say otherwise ==
14 Nov 2026 2026-11-14
14 NOV 2026 DateTimeParseException: Text '14 NOV 2026' could not be parsed at index 3
14 NOV 2026 (parseCaseInsensitive) 2026-11-14
== the old SimpleDateFormat, same 31-02-2026 ==
lenient (default): Tue Mar 03 00:00:00 IST 2026
setLenient(false): ParseException: Unparseable date: "31-02-2026"