// Even with a "cast" of DATE to TIMESTAMP the value should be considered "yyyy-mm-hh 00:00:00"
Calendar calendar = Calendar.getInstance();
int timezoneOffset = calendar.get( Calendar.ZONE_OFFSET ) + calendar.get( Calendar.DST_OFFSET );
long shiftedTime = ( ( (Integer) value ).longValue() * MILLIS_PER_DAY ) + timezoneOffset;
ZonelessDatetime date = createInstance();
date.setZonedTime( shiftedTime, DateTimeUtil.defaultZone );
if( to == String.class )
return date.toString();
if( to == java.sql.Date.class )
return new java.sql.Date( date.getJdbcDate( DateTimeUtil.defaultZone ) );
if( to == java.sql.Timestamp.class )
return new java.sql.Timestamp( date.getJdbcTimestamp( DateTimeUtil.defaultZone ) );
if( to == java.sql.Time.class )
return new java.sql.Time( date.getJdbcTime( DateTimeUtil.defaultZone ) );
throw new CascadingException( "unknown type coercion requested, from: " + Util.getTypeName( from ) + " to: " + Util.getTypeName( to ) );
}