Timezones in SQL DATE vs java.sql.Date

后端 未结 7 775
天涯浪人
天涯浪人 2020-11-28 04:11

I\'m getting a bit confused by the behaviour of the SQL DATE data type vs. that of java.sql.Date. Take the following statement, for example:



        
7条回答
  •  遥遥无期
    2020-11-28 05:03

    I think timezone issues are being over-complicated. When you pass a date/time to prepared statement, it only sends date and/or time info to the database server. As per defacto standard, it doesn't manipulate the timezones differences between database server and jvm. And later when you read the date/time from the result set. It just reads date time info from the database, and creates the same date/time in the jvm timezone.

提交回复
热议问题