get_block_timestamp

Documentation for eth_defi.timestamp.get_block_timestamp function.

get_block_timestamp(web3, block_identifier)[source]

Get a block timestamp.

Slow method. Use only for individual queries.

Returns

Timezone naive UTC datetime

Parameters
  • web3 (web3.main.Web3) –

  • block_identifier (Union[Literal['latest', 'earliest', 'pending', 'safe', 'finalized'], eth_typing.evm.BlockNumber, eth_typing.evm.Hash32, eth_typing.encoding.HexStr, hexbytes.main.HexBytes, int]) –

Return type

datetime.datetime