Timestamps and Dates
1 min
Time measurement in Signum works a bit different than in Javascript or any other modern programming language, i.e. the timestamps delivered in the nodes responses are based on the beginning of the blockchain, the Genesis Block. So, when dealing with real world dates the timestamp of a block needs to be converted. And like with Amount and ChainValue a value object class is available for that also: ChainTime
const {ChainTime} = require("@signumjs/util");
console.log('The current block timestamp is', ChainTime.fromDate(new Date()).getChainTimestamp())
console.log('The Signum Mainnet went live on', ChainTime.fromChainTimestamp(0).getDate().toUTCString(), '(local time)')
console.log('Expressed in the Epoch timestamp (1.1.1970) it was', ChainTime.fromChainTimestamp(0).getEpoch())