springBoot + mysql + swagger.html time zone problem

springBoot + mysql + swagger.html time zone problem

Modify the database time zone

//查看mysql当前时间
show variables like "%time_zone%";
//修改
set global time_zone = '+8:00';
set time_zone = '+8:00';
flush privileges;

If the back-end database with no problem, it is the front desk json conversion issues, add annotation on the entity class attribute of type Date

@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
Released nine original articles · won praise 4 · Views 3143

Guess you like

Origin blog.csdn.net/weixin_43642706/article/details/103290132