Mybatis Mysql query in time datetime type, a difference of 8 hours Solution

Just just solve the problem of time format, suddenly found time to check out and stored in the database of the time difference of eight hours

 

 Because Mysql use the system default time zone, the East eight districts.

 

But I handled the business district UTC when logic in the link database

spring.datasource.url=jdbc:mysql://localhost/laidoulailareset?
characterEncoding=utf8&useSSL=true&serverTimezone=UTC

So there will be time difference of eight hours

Modify way: serverTimezone = Asia / Shangha

spring.datasource.url=jdbc:mysql://localhost/laidoulailareset?
characterEncoding=utf8&useSSL=true&serverTimezone=Asia/Shanghai
He published 183 original articles · won praise 26 · views 40000 +

Guess you like

Origin blog.csdn.net/SEVENY_/article/details/104122758