MySQL runs with timezone "GMT+8", but Tomcat with "GMT". When I save datetime to my database, everything seems to be OK, but when I check the datetime value in the database, I see the "GMT" value.
Also when I try get the value from the database the value is changed, seems like the value in the database is taken as "GMT+8", so Java changes the value to "GMT".
I have set the connection URL like this:
useTimezone=true&serverTimezone=GMT
but it does not work.
JDBC uses a so-called "connection URL", so you can escape "+" by "%2B", that is
useTimezone=true&serverTimezone=GMT%2B8
For applications such as Squirrel SQL Client (http://squirrel-sql.sourceforge.net/) version 4 you can set "serverTimezone" under "driver properties" to GMT+1
(example of timezone "Europe/Vienna).
Is there a way we can get the list of supported timeZone from MySQL ? ex - serverTimezone=America/New_York. That can solve many such issue. I believe every time you need to specify the correct time zone from the Application irrespective of the DB TimeZone.
Source: Stackoverflow.com