parsing - How do I create a java.time.LocalDate from a date string using the "d. LLLL YYYY" pattern? -
i'm trying create localdate object:
localdate date = localdate.parse( "1. juli 2014", datetimeformatter.ofpattern("d. llll yyyy", new locale("nb", "no")); but exception:
java.time.format.datetimeparseexception: text '1. juli 2014' not parsed: unable obtain localdate temporalaccessor: {weekbasedyear[weekfields[monday,4]]=2014, monthofyear=7, dayofmonth=1}, iso of type java.time.format.parsed @ java.time.format.datetimeformatter.createerror(datetimeformatter.java:1919) @ java.time.format.datetimeformatter.parse(datetimeformatter.java:1854) @ java.time.localdate.parse(localdate.java:400) the exception seems indicate right info in there ("juli" norwegian , month number 7).
so, found solution, though this java 8 bug, @nimchimpsky commented on.
by using "d. llll yyyy" (with year-of-era) instead of "d. llll yyyy" (with week-based-year), parsing works intended.
java parsing date java-8
No comments:
Post a Comment