Java JDBC: dates consistently two days off

前端 未结 9 1847
孤城傲影
孤城傲影 2020-12-14 16:53

I am using Java JDBC to write a date to SQL server 2008 and then read it back.
The date that is read back is consistently two days earlier than the date that was actuall

9条回答
  •  臣服心动
    2020-12-14 16:53

    I had the same exact problem even using sqljdbc4 with Java 8.

    Once i don´t need this field to make any type of comparison in the application i solved the issue by casting the field in my query like this: CAST(dbo.tblPwActividadeParticipanteDetalhe.Data AS VARCHAR(10)).

提交回复
热议问题