Search code examples
datespring-bootjackson2

Date stored in different format


I have this date "2018-05-30T16:19:58.016Z" coming from my Angular app. In Spring, the field date is as follows :

@JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")
private Date date;

The date is well stored, but with this format YYYY-MM-dd. enter image description here

Is there anything that I'm missing ?


Solution

  • MySql date type can't hold data with timestamp. It has to be datetime in order to contain date time with timestamp data.