Skip to main content
code formatting, wrapped a line to make it all visible
Source Link

web3.eth.getTransaction({txhash})web3.eth.getTransaction({txhash}) will contain a blockNumber.

Use web3.eth.getBlock to retrieve the block details and you will find the following field:

 timestamp: Number - the unix timestamp for when the block was collated.

This is a Unix timestamp.

Example using geth for the following transaction 0x5da2844afb6826d4baed6ad7e8b536c00cbc921ac147773ad056f29f2e7c1762.

> let tx = "0x5da2844afb6826d4baed6ad7e8b536c00cbc921ac147773ad056f29f2e7c1762"
> web3.eth.getTransaction("0x5da2844afb6826d4baed6ad7e8b536c00cbc921ac147773ad056f29f2e7c1762"tx).blockNumber
1920050
> web3.eth.getBlock(1920050).timestamp
1469021581

And using www.unixtimestamp.com, this works out to be 07/20/2016 @ 1:33pm (UTC) which matches the etherscan.io details.

web3.eth.getTransaction({txhash}) will contain a blockNumber.

Use web3.eth.getBlock to retrieve the block details and you will find the following field:

 timestamp: Number - the unix timestamp for when the block was collated.

This is a Unix timestamp.

Example using geth for the following transaction 0x5da2844afb6826d4baed6ad7e8b536c00cbc921ac147773ad056f29f2e7c1762.

> web3.eth.getTransaction("0x5da2844afb6826d4baed6ad7e8b536c00cbc921ac147773ad056f29f2e7c1762").blockNumber
1920050
> web3.eth.getBlock(1920050).timestamp
1469021581

And using www.unixtimestamp.com, this works out to be 07/20/2016 @ 1:33pm (UTC) which matches the etherscan.io details.

web3.eth.getTransaction({txhash}) will contain a blockNumber.

Use web3.eth.getBlock to retrieve the block details and you will find the following field:

 timestamp: Number - the unix timestamp for when the block was collated.

This is a Unix timestamp.

Example using geth for the following transaction 0x5da2844afb6826d4baed6ad7e8b536c00cbc921ac147773ad056f29f2e7c1762.

> let tx = "0x5da2844afb6826d4baed6ad7e8b536c00cbc921ac147773ad056f29f2e7c1762"
> web3.eth.getTransaction(tx).blockNumber
1920050
> web3.eth.getBlock(1920050).timestamp
1469021581

And using www.unixtimestamp.com, this works out to be 07/20/2016 @ 1:33pm (UTC) which matches the etherscan.io details.

Update
Source Link
BokkyPooBah
  • 40.4k
  • 14
  • 123
  • 193

web3.eth.getTransaction({txhash}) will contain a blockNumber.

Use web3.eth.getBlock to retrieve the block details and you will find the following field:

 timestamp: Number - the unix timestamp for when the block was collated.

This is a Unix timestamp.

Example using geth for the following transaction 0x5da2844afb6826d4baed6ad7e8b536c00cbc921ac147773ad056f29f2e7c1762.

> web3.eth.getTransaction("0x5da2844afb6826d4baed6ad7e8b536c00cbc921ac147773ad056f29f2e7c1762").blockNumber
1920050
> web3.eth.getBlock(1920050).timestamp
1469021581

And using www.unixtimestamp.com, this works out to be 07/20/2016 @ 1:33pm (UTC) which matches the etherscan.io details.

web3.eth.getTransaction({txhash}) will contain a blockNumber.

Use web3.eth.getBlock to retrieve the block details and you will find the following field:

 timestamp: Number - the unix timestamp for when the block was collated.

This is a Unix timestamp.

web3.eth.getTransaction({txhash}) will contain a blockNumber.

Use web3.eth.getBlock to retrieve the block details and you will find the following field:

 timestamp: Number - the unix timestamp for when the block was collated.

This is a Unix timestamp.

Example using geth for the following transaction 0x5da2844afb6826d4baed6ad7e8b536c00cbc921ac147773ad056f29f2e7c1762.

> web3.eth.getTransaction("0x5da2844afb6826d4baed6ad7e8b536c00cbc921ac147773ad056f29f2e7c1762").blockNumber
1920050
> web3.eth.getBlock(1920050).timestamp
1469021581

And using www.unixtimestamp.com, this works out to be 07/20/2016 @ 1:33pm (UTC) which matches the etherscan.io details.

Source Link
BokkyPooBah
  • 40.4k
  • 14
  • 123
  • 193

web3.eth.getTransaction({txhash}) will contain a blockNumber.

Use web3.eth.getBlock to retrieve the block details and you will find the following field:

 timestamp: Number - the unix timestamp for when the block was collated.

This is a Unix timestamp.