For year you have to use the lowercase y:
final DateTimeFormatter DATE_FORMAT = DateTimeFormatter.ofPattern("dd-MM-yyyy");
Uppercase Y is used for weekyear. See the javadoc of DateTimeFormatter for more details.
More Related Contents:
- 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
- UnsupportedTemporalTypeException when formatting Instant to String
- 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
- Mocking time in Java 8’s java.time API
- How can I parse/format dates with LocalDateTime? (Java 8)
- Format a date using the new date time API
- Convert java.util.Date to what “java.time” type?
- Calculate days between two Dates in Java 8
- Unable to obtain LocalDateTime from TemporalAccessor when parsing LocalDateTime (Java 8)
- Any difference between java.time.Clock.systemDefaultZone().getZone() vs java.util.TimeZone.getDefault().toZoneId()?
- cannot resolve symbol ‘java.time.LocalDate’ error in android studio
- JPA support for Java 8 new date and time API
- JDK dateformatter parsing DayOfWeek in German locale, java8 vs java9
- Unit testing a class with a Java 8 Clock
- Unable to obtain ZonedDateTime from TemporalAccessor using DateTimeFormatter and ZonedDateTime in Java 8
- Convert between LocalDate and sql.Date [duplicate]
- Why can’t I get a duration in minutes or hours in java.time?
- How to extract epoch from LocalDate and LocalDateTime?
- Unable to obtain OffsetDateTime from TemporalAccessor
- Get original pattern String given a JDK 8 DateTimeFormatter?
- String to ZonedDateTime is changing format
- DateTimeFormatter Support for Single Digit Day of Month and Month of Year
- Java 8: Calculate difference between two ZonedDateTime
- How to combine date and time into a single object?
- What’s the difference between ZonedDateTime and OffsetDateTime?