springboot插入mysql中时间格式不对问题

1,215 阅读1分钟

1.在数据库连接中加入serverTimezone=GMT%2B8

2.在po层的属性上加入@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")

@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date qkldzStart;

终级办法:日期设置成varchar,一了百了