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 specifyCalendarin UTC timezone. - For Spring
jdbcTemplateinstead of insertingDateobject, insertCalendarwithUTCtimezone TimeZone.setDefault(TimeZone.getTimeZone("GMT"))could be set on JVM lvl- Use
-Duser.timezone=GMTon JVM startup
No comments:
Post a Comment