# getBlockTime

Solana API method that returns the estimated production time of a block.

Information

Each validator regularly reports its UTC time to the ledger by intermittently adding a timestamp to a vote for a particular block. A requested block's time is calculated from the stake-weighted mean of the vote timestamps in a set of recent blocks recorded on the ledger.

Parameters:

  • <u64> — the block, identified by the slot.

Returns:

  • <i64> — the estimated production time, as a Unix timestamp, seconds since the Unix epoch (opens new window).
  • <null> — if the timestamp is not available for this block.

Example:

  • Solana web3.js
  • Solana.py
  • cURL
import { PublicKey, Connection } from "@solana/web3.js"

const nodeUrl = "CHAINSTACK_NODE_URL"
const connect = new Connection(nodeUrl);

(async () => {  
  console.log(await connect.getBlockTime(151696557));
})();