java.time.LocalDateTime success = java.time.LocalDateTime.parse("20 01 2014 15 36 21 234",java.time.format.DateTimeFormatter.ofPattern("dd MM yyyy HH mm ss SSS"));
java.time.LocalDateTime fails = java.time.LocalDateTime.parse("20012014153621234",java.time.format.DateTimeFormatter.ofPattern("ddMMyyyyHHmmssSSS"));
reference: http://docs.oracle.com/javase/8/docs/api/java/time/format/DateTimeFormatter.html
Question: The formatter/parser seems to not distinguisch between fixed and variable items. eg. d="day-of-month" used as "dd" could be one or two digits (eg. 8 or 18). Therefore the parser does not use "fixed" lengths as it tries to parse the next "item". But the "items" are not separated and the parsing fails.
Am i right? Is there a fix for this?
Edit: Interestingly this works:
java.time.LocalDate date1 = java.time.LocalDate.parse("20140120", java.time.format.DateTimeFormatter.ofPattern("yyyyMMdd"));
java.time.LocalTime time1 = java.time.LocalTime.parse("153621234", java.time.format.DateTimeFormatter.ofPattern("HHmmssSSS"));
but why not for Date+Time ?