0

How to translate Timestamp to something readable? E.g. 1525344824207849500

var blocknumber = web3.eth.blockNumber;
var blockHash = web3.eth.getBlock(blocknumber).hash;
var timestamp = web3.eth.getBlock(blocknumber).timestamp;

Nathan Aw

1 Answer 1

1

Timestamp is the unix time, ie number of seconds since 1970-01-01 00:00. And javascript's Date is the number of milliseconds since the same date. So something like this work

new Date(timestamp * 1000)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.