How can I get the time for a transaction

+3 votes

Hi, 

When using some API to get transaction detail (listaddresstransactions, getaddresstransaction ..) I notice that there are some field: time, timereceived, blocktime and so on . Which one is exactly the time that transaction was performed? 

By the way, it is a long number. How can I convert it into normal Date/Time (for example .NET DateTime )

asked Mar 31, 2016 by tuanba1

1 Answer

+3 votes

The transaction has no timestamp that is built into it, so there is no answer to the question you are asking. Each node has its own time when it first saw the transition (timereceived) and first added it to its local wallet (time). But all nodes should agree on the blocktime, which is the timestamp of the block in which the transaction was confirmed (if it has already been confirmed, that is).

answered Mar 31, 2016 by MultiChain
And to answer your other question, it's a Unix-style timestamp, which is a very common time format. So please look up the way to convert that into the format you want.
...