Here you can find the source of encodeTimestamp(Timestamp timestamp)
public static ByteBuffer encodeTimestamp(Timestamp timestamp)
//package com.java2s; // Licensed to the Apache Software Foundation (ASF) under one import java.nio.ByteBuffer; import java.sql.Timestamp; public class Main { /**//w ww . java 2 s. co m * Encodes a TIMESTAMP value. */ public static ByteBuffer encodeTimestamp(Timestamp timestamp) { if (timestamp == null) throw new NullPointerException("timestamp cannot be null."); ByteBuffer buffer = ByteBuffer.allocate(8 + 4); buffer.putLong(timestamp.getTime() / 1000); buffer.putInt(timestamp.getNanos()); buffer.rewind(); return buffer; } }