public final static byte[] encodeTimestamp(java.sql.Timestamp value){        datetime d = new datetime(value);  byte[] date = d.toDateBytes(); byte[] time = d.toTimeBytes();  byte[] result = new byte[8]; System.arraycopy(date, 0, result, 0, 4); System.arraycopy(time, 0, result, 4, 4);  return result; }
public final static java.sql.Timestamp encodeTimestamp(java.sql.Timestamp value, Calendar cal){ if (cal == null) { return value; } else { long time = value.getTime() - cal.getTimeZone().getRawOffset(); return new java.sql.Timestamp(time); } }
    public final static byte[] encodeTimestamp(java.sql.Timestamp value){        // note, we cannot simply pass millis to the database, because        // Firebird stores timestamp in format (citing Ann W. Harrison):        //        // "[timestamp is] stored a two long words, one representing         // the number of days since 17 Nov 1858 and one representing number         // of 100 nano-seconds since midnight"        datetime d = new datetime(value);        byte[] date = d.toDateBytes();        byte[] time = d.toTimeBytes();        byte[] result = new byte[8];        System.arraycopy(date, 0, result, 0, 4);        System.arraycopy(time, 0, result, 4, 4);        return result;    }