I'm using @polkadot-js to decode extrinsic data. The following method call returns a timestamp at a specific block, but I don't know how to parse this.

I tried assuming that it's a unix timestamp in seconds and parsing it like so, but it doesn't fit. Is this in nanoseconds? milliseconds?

How can I parse it into a date object in my favorite programming language?

const timestamp = await api.query.timestamp.now.at(blockHash);

The docs: https://polkadot.js.org/docs/substrate/storage#now-u64

Example: 1590512778000 (Could it be that my timestamps being incorrectly decoded?)

2 Answers 2


Substrate are time stamped by a number of milliseconds since 1 January 1970 UTC.

This convention is widely adopted by many modern programming environments. Here is a simple example in JS with the timestamp you provided:

let time = new Date(1590512778000)
> "Tue May 26 2020 11:06:18 GMT-0600 (Mountain Daylight Time)"
  • 1
    Originally unix timestamps are represented by seconds. It's worth clarifying that in Substrate this number is in milliseconds.
    – pepyakin
    Feb 18, 2022 at 13:50

Hmm.. I guess it's an epoch mill

use below site.


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.