Cause: The time difference between @jsonFormat (pattern=” YYYY-MM-DD “) is abnormal
Explanation: by default timeZone is GMT (standard timeZone), and Beijing is in e8, so there is a difference of 8 hours.
Timezone = “GMT+8
1 @JsonFormat(pattern=”yyyy-MM-dd HH:mm:ss”, timezone = “GMT+8”)
2 You can also modify the MySQL configuration in Springboot Application. yml
druid:
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql: / /localhost: 3306 /renren_students?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai
username: root
password: 123456
Copy the code