The Json format and time zone problem occurs when the front-end of the SpringBoot project transmits the time attribute to the back-end

Error updating database. Cause: com.mysql.cj.jdbc.exceptions.MysqlDataTruncation: Data truncation: Incorrect datetime value: ‘1970-01-01 00:00:00.007’ for column ‘bir’ at row 1

Solution

Add the date field in the entity class

@JsonFormat(pattern = "yyyy-MM-dd",timezone = "GTM+8")

Insert picture description here

Guess you like

Origin blog.csdn.net/weixin_46195957/article/details/110509070