This is the code:
LocalDateTime localDateTime = LocalDateTime.ofInstant(Instant.ofEpochMilli(1451438792953L), ZoneId.of("UTC"));
DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("YYYY-MM-dd'T'HH:mm:ss.SSS'Z'");
String output = dateTimeFormatter.format(localDateTime);
This is the value of localDateTime
:
2015-12-30T01:26:32.953
This is the value of output
:
2016-12-30T01:26:32.953Z
Why does it add a year?
In java.time.temporal.WeekFields
there are a couple of methods with a newYearWeek
which increment the year by 1
on occasion. Why?
This is a strange bug.