@Override public DateTime fromNonNullValue(Timestamp value) { DateTimeZone currentDatabaseZone = databaseZone == null ? ZoneHelper.getDefault() : databaseZone; DateTimeZone currentJavaZone = javaZone == null ? ZoneHelper.getDefault() : javaZone; int adjustment = TimeZone.getDefault().getOffset(value.getTime()) - currentDatabaseZone.getOffset(null); DateTime dateTime = new DateTime(value.getTime() + adjustment); DateTime dateTimeWithZone = dateTime.withZone(currentJavaZone); return dateTimeWithZone; }
@Override public Timestamp toNonNullValue(DateTime value) { DateTimeZone currentDatabaseZone = databaseZone == null ? ZoneHelper.getDefault() : databaseZone; int adjustment = TimeZone.getDefault().getOffset(value.getMillis()) - currentDatabaseZone.getOffset(null); final Timestamp timestamp = new Timestamp(value.getMillis() - adjustment); return timestamp; }