Java SQL date is off by 1 day

前端 未结 2 1457
故里飘歌
故里飘歌 2021-01-22 20:57

I\'m using a MySQL server which is located in the same timezone as me. Im trying to insert a java.util.Date into the database on a column of type DATE with the foll

2条回答
  •  灰色年华
    2021-01-22 21:09

    This issue is coming from the MySQL Connector in java. Version 8.0.19 converts the date using the JVMs timezone which results in the 1 day off problem. This is resolved in the 8.0.20 patch. Read here https://dev.mysql.com/doc/relnotes/connector-j/8.0/en/

提交回复
热议问题