0

I user hibernate+spring+mysql 5.7. When I save date 20/04/1939, it stores correctly in database.

@Column(name = "birth_date")
    @Temporal(TemporalType.DATE)
    private Date birthDate;

the value stored in database after save is 1939-04-20.

when i display it using

person.getBirthDate()

it displays 19/04/1939. It is not related with my formatting. The value it retrieves from db is one day less.

It is always showing 1 day less when i use year 1939 with any date. So what's wrong here? Also for other years, dates are showing perfectly.

Apostolos
  • 7,672
  • 3
  • 20
  • 32
TanvirChowdhury
  • 2,254
  • 20
  • 25

1 Answers1

0

updating the database timezone solved this issue.

TanvirChowdhury
  • 2,254
  • 20
  • 25