*/
public static Timestamp convertTimestamp(Value value, Calendar calendar) {
if (value == ValueNull.INSTANCE) {
return null;
}
ValueTimestamp ts = (ValueTimestamp) value.convertTo(Value.TIMESTAMP);
Calendar cal = (Calendar) calendar.clone();
cal.clear();
cal.setLenient(true);
long dateValue = ts.getDateValue();
long nanos = ts.getNanos();
long millis = nanos / 1000000;
nanos -= millis * 1000000;
long s = millis / 1000;
millis -= s * 1000;
long m = s / 60;