When I insert new Date() object using jdbcTemplate to Oracle database, I can see that jdbc driver or Spring jdbcTemplate insert Date using local JVM offset.
SimpleDateFormat sdf = new SimpleDateFormat("dd-MMM-yyyy");
sdf.setTimeZone(TimeZone.getTimeZone("UTC"));
Date timeZoneDate = sdf.parse("09-SEP-1987");
For example when I insert Date object created in GMT this result to inserting 08-SEP-1987 in Oracle database if JVM timezone is USA.
Neither
java.util.Datenor OracleDatestores timezone information. In your case Jdbc driver converts your date using the JVM timezone. You can use one of the following options:setDate(intmethod to specifyparameterIndex, Date x, Calendar cal)
Calendarin UTC timezone.
jdbcTemplateinstead of insertingDateobject, insertCalendarwithUTCtimezoneTimeZone.setDefault(TimeZone.getTimeZone("GMT"))could be set on JVM lvl-Duser.timezone=GMTon JVM startup