Answer the question
In order to leave comments, you need to log in
Why are the resulting values so different when converting java.util.Date to Instant?
log.debug("Date is " + date);
Instant instant = date.toInstant();
log.debug("Instant date is " + instant);
LocalDateTime localTime = LocalDateTime.ofInstant(instant, ZoneId.systemDefault());
2016-05-25-15:57:16.729 DEBUG|G|rrcsdDocGeneratorService|Date is Mon Dec 12 00:00:00 MSK
1222 -12-18T21:00:00Z
2016-05-25-15:57:16.734 DEBUG|G|rrcsdDocGeneratorService|Local date is 1222-12-18T21:00:00Z
Answer the question
In order to leave comments, you need to log in
This is because of the difference between the Julian and Gregorian calendar.
The date API from java.util.* before October 14, 1582 uses the Julian calendar, and after the Gregorian.
The API from java.time.* uses the proleptic Gregorian calendar.
And on the dates indicated, there was just a difference of 8 days between the Julian and the proleptic Gregorian calendar.
https://ru.wikipedia.org/wiki/%D0%9F%D1%80%D0%BE%D...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question