long dateValueInMs = calendar.getTimeInMillis();
long tzOffset = calendar.get(Calendar.ZONE_OFFSET) +
calendar.get(Calendar.DST_OFFSET);
// get the timeZone specified in trinidad-config, if any or the
// client timeZone.
LocaleContext localeContext = arc.getLocaleContext();
// find out the difference in timeZone
tzOffset -= localeContext.getTimeZone().getOffset(dateValueInMs);
// Bug 4570118
// make sure that adjusting to correct timeZone doesn't take the
// long value out of the range. Calendar too doesn't handle this
// properly ie. MIN_VALUE < (longValue + tzOffset) < MAX_VALUE.