Springboot time zone problem

1. Add the


void   setDefaultTimezone()  {
2. Add the

 ##  json   setting
spring.jackson.date-format=yyyy-MM-dd   HH:mm:ss
3. Add the

public static void main(String[] args) {


  SpringApplication.run(BaseMicroServiceApplication.class, args);


// Otherwise, there will be 8-hour time difference on the server

Or in the database:

After logging in as root, set global time_ zone=’+8:00′;

Mysql database has time zone setting, and the system time zone is used by default

You can query the current time zone through the following statement

show variables like ‘%time_ zone%’;

Read More: