---
title: getBlockTime
description: >-
  Returns the estimated production time for a block.
url: /docs/rpc/http/getblocktime
type: reference
hideTableOfContents: true
---

Returns the estimated production time for a block.

<Callout type="info" title="Source">
  [`get_block_time`](https://github.com/anza-xyz/agave/blob/v3.1.8/rpc/src/rpc.rs#L1577)
</Callout>

<Callout type="info">
  Each validator reports their UTC time to the ledger on a regular interval 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.
</Callout>

<APIMethod>

```jsonc !!request curl
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "getBlockTime",
  "params": [
    // !hover slot number
    377268280
  ]
}
```

```ts !!request title="Kit"
import { createSolanaRpc } from "@solana/kit";

const rpc_url = "https://api.devnet.solana.com";
const rpc = createSolanaRpc(rpc_url);

// !hover slot number
let slotNumber = BigInt(377268280);
let blockTime = await rpc.getBlockTime(slotNumber).send();

console.log("Block time:", blockTime);
```

```ts !!request title="web3.js"
import { Connection, clusterApiUrl } from "@solana/web3.js";

const connection = new Connection(clusterApiUrl("devnet"), "confirmed");

// !hover slot number
let slotNumber = 377268280;
let blockTime = await connection.getBlockTime(slotNumber);

console.log("Block time:", blockTime);
```

```rs !!request title="Rust"
use anyhow::Result;
use solana_client::nonblocking::rpc_client::RpcClient;
use solana_commitment_config::CommitmentConfig;

#[tokio::main]
async fn main() -> Result<()> {
    let client = RpcClient::new_with_commitment(
        String::from("https://api.devnet.solana.com"),
        CommitmentConfig::confirmed(),
    );

    // !hover slot number
    let slot_number = 377268280;

    let block_time = client.get_block_time(slot_number).await?;

    println!("Blocks time: {:?}", block_time);

    Ok(())
}
```

### !params

#### !! slot number

!type u64  
!required

Slot number to query, as a u64 integer.

### !!result available

```jsonc !response
{
  "jsonrpc": "2.0",
  // !hover result
  "result": 1574721591,
  "id": 1
}
```

!type i64

Estimated production time, as Unix timestamp (seconds since the Unix epoch)

### !!result unknown time

```jsonc !response
{
  "jsonrpc": "2.0",
  // !hover result
  "result": null,
  "id": 1
}
```

!type null

Returned when the block is available but no block time has been recorded.

### !!result unavailable

```jsonc !response
{
  "jsonrpc": "2.0",
  // !hover(1:4) result
  "error": {
    "code": -32004,
    "message": "Block not available for slot 150"
  },
  "id": 1
}
```

!type object

Error object

</APIMethod>
