I have a transaction ID and I need to get the time of input and the of output of that transaction (Unix timestamp) programatically using a block explorer or any API.

Is this possible ? If so how can I do that ?

  • 1
    Transactions don't have a time. You can look up the timestamp of the block it was included in (which itself may be minutes to an hour off of the real time it was created). Commented Jul 24, 2018 at 13:51

1 Answer 1


Transactions do not have an individual timestamp. The closest you can do is get the timestamp from the block that it was included in (but note Pieter's warning about accuracy).

API Example

Using blockchain.info, for example you can do:


For $tx_hash = b6f6991d03df0e2e04dafffcd6bc418aac66049e2cd74b80f14ac86db1e3f0da this would return:

    "block_height: 12200,






From there you can query the block height of the inputs the same way as above using the inputs[i].prev_out.hash field. Then, to get the timestamp for a block, just query the raw block by height. E.g. for the output timestamps, you would use block_height: 12200 for the example above:


The timestamp would be returned in blocks[0].time

Note: Transactions technically can have an individual timestamp. When they do, it is the locktime property, see Bitcoin Wiki - Transaction. However, the locktime is most likely not going to be the time that it was created, rather, the time it is available for spending:

if non-zero and sequence numbers are < 0xFFFFFFFF: block height or timestamp when transaction is final

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.