It turns out Java does not accept a bare Date value as DateTime. Using LocalDate instead of LocalDateTime solves the issue:
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMdd");
LocalDate dt = LocalDate.parse("20140218", formatter);
More Related Contents:
- UnsupportedTemporalTypeException when formatting Instant to String
- What’s the difference between Instant and LocalDateTime?
- How to parse/format dates with LocalDateTime? (Java 8)
- Convert java.util.Date to java.time.LocalDate
- Converting between java.time.LocalDateTime and java.util.Date
- Cannot parse String in ISO 8601 format, lacking colon in offset, to Java 8 Date
- Java 8: Difference between two LocalDateTime in multiple units
- Difference between year-of-era and week-based-year?
- How to get milliseconds from LocalDateTime in Java 8
- How can I create a Java 8 LocalDate from a long Epoch time in Milliseconds?
- Differences between Java 8 Date Time API (java.time) and Joda-Time
- Unable to obtain ZonedDateTime from TemporalAccessor using DateTimeFormatter and ZonedDateTime in Java 8
- Mocking time in Java 8’s java.time API
- Can’t parse String to LocalDate (Java 8)
- convert epoch time to date
- How can I parse/format dates with LocalDateTime? (Java 8)
- Get original pattern String given a JDK 8 DateTimeFormatter?
- Format a date using the new date time API
- Java 8: Calculate difference between two ZonedDateTime
- How to serialize and deserialize Java 8’s java.time types with Gson? [closed]
- How to combine date and time into a single object?
- Convert java.util.Date to what “java.time” type?
- Reverse a comparator in Java 8
- Why is “final” not allowed in Java 8 interface methods?
- Is this a bug in Files.lines(), or am I misunderstanding something about parallel streams?
- String Deduplication feature of Java 8
- stream on JPA lazy list
- How to apply multiple predicates to a java.util.Stream?
- Does Java 8 provide a good way to repeat a value or function?
- Visualization of Java Stream parallelization