I am new to hbase and currently I am using hbase-1.2.6. I did the connection to hbase using python script by using happybase package. my question is : can someone please let me know how to decode timestamp value which is automatically inserted whenever we put any records in table?
1.what is the exact interpretation of timestamp value in hbase?
2.can we convert this timestamp value to yy-mm-dd-hh:mm:ss format?
The timestamp value is the number of milliseconds since the epoch (January 1, 1970 UTC). You can use the python datetime
module to manipulate it. Example:
from datetime import datetime as dt
print (dt.fromtimestamp(1511356398000 / 1000))
Output:
2017-11-22 07:13:18
The result is a datetime
object in my local time zone. (Central USA) The datetime.fromtimestamp
method wants a floating point value that is the time in seconds since the epoch, so divide the time in milliseconds by 1000.
Here is the datetime
module reference.