[Java、HBase] Retrieving timestamp form HBase row

Ref. stackoverflow: retrieving timestamp from hbase row

HTableInterface hTableInterface = CONNECTION.getTable(Table.SCHEMA_NAME);
Result result = hTableInterface.get(get);
Date date = new Date(result.raw()[0].getTimestamp());
System.out.println("DateTime: " + sdf.format(date));

we must edit HBaseSettings to set hbaseConf.set(HBASE_ENV_KEY_ZOOKEEPER_QUORUM, “target_zookeeper_address”);

This entry was posted in HBase, Java and tagged , . Bookmark the permalink.