0

If the date in the database row is at least a couple hundred years old, the LocalDate object gets offset by a certain value.

For example, I have a database row with a date of 1232-12-31, and the LocalDate object returns 1233-01-07.

1500-12-31 returns 1501-01-10 and so on.

Is this caused by leap years? Or something else? Is there a possible solution for this? Or just an explanation?

If it's of any help I use PostgreSQL 12 and Hibernate(5.2.9-final) + Spring Boot(1.4.1.RELEASE) for the application and Entity classes for my tables.

lapartman
  • 45
  • 1
  • 7
  • 2
    In 1752 there was a switch from the Julian calendar to the Gregorian calendar. If you are dealing in historical dates you should take care of the calendars to which they belong. – RealSkeptic Jun 23 '21 at 08:50
  • Thank you, I've found a possible explanation I'm going to link as an answer for this question. – lapartman Jun 23 '21 at 08:59
  • 1
    [Possible explanation for this is the accepted answer for this question](https://stackoverflow.com/questions/44801189/how-to-convert-util-date-to-time-localdate-correctly-for-dates-before-1893) – lapartman Jun 23 '21 at 09:01

0 Answers0