Tag Archives: Java

[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”);

Posted in HBase, Java | Tagged , | Leave a comment

[Java] Transform currentTimeMillis to readable date format

Ref. stackoverflow: how-to-transform-currenttimemillis-to-a-readable-date-format SimpleDateFormat sdf = new SimpleDateFormat(“MMM dd,yyyy HH:mm”); Date date = new Date(System.currentTimeMillis()); System.out.println(“DateTime: ” + sdf.format(date));

Posted in Java | Tagged | Leave a comment