calcite-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ayelet Morris <ayelet.mor...@gigaspaces.com>
Subject Timestamp/Date offset added to already localized date returned from DB
Date Tue, 26 May 2020 06:32:43 GMT
Hi All,
I see in TimestampAccessor and in DateAccessor that the timestamp/date
received is already localized and the calendar is the same as the one
defined in the configuration as localCalendar, then the code only checks if
calendar exists and adds it's offset to the date. it creates an error in my
timestamp in some scenarios.

I thought that maybe it is possible to check if the timestamp/date uses the
same calendar as defined in config and then not to use the offset on it, or
at least calculate the offset from the timestamp object calendar and not
always from 0...

for example, to consider it in this code:

@Override public Timestamp getTimestamp(Calendar calendar) throws SQLException {
  Timestamp timestamp  = (Timestamp) getObject();
  if (timestamp == null) {
    return null;
  }
  if (calendar != null) {
    long v = timestamp.getTime();
    v -= calendar.getTimeZone().getOffset(v);
    timestamp = new Timestamp(v);
  }
  return timestamp;
}


WDYT?
Thanks,
Ayelet

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message