Neither
java.util.Date
nor Oracle Date
stores timezone information. In your case Jdbc driver converts your
date using the JVM timezone. You can use one of the following options:- If you are using PreparedStatement, you can use
setDate(int parameterIndex, Date x, Calendar cal)
method to specifyCalendar
in UTC timezone. - For Spring
jdbcTemplate
instead of insertingDate
object, insertCalendar
withUTC
timezone TimeZone.setDefault(TimeZone.getTimeZone("GMT"))
could be set on JVM lvl- Use
-Duser.timezone=GMT
on JVM startup
No comments:
Post a Comment