https://bitcoin.org/en/developer-reference#gettransaction
As prev. mentioned:
When doing bitcoin-cli help gettransaction I get:
"timereceived" : ttt, (numeric) The time received in seconds since epoch (1 Jan 1970 GMT)
However, the docs says:
Name: time
Type: number (int)
Presence: Required (exactly 1)
Description: A Unix epoch time when the transaction was added to the wallet
Name: timerecived [sic]
Type: number (int)
Presence: Required (exactly 1)
Description: A Unix epoch time when the transaction was detected by the local node, or the time of the block on the local best block chain that included the transaction
So for all intents and purposes when sending bitcoins from the local node, 'time' should be sufficient to determine when the user sent the coins, as a send transaction, to my understanding is immediately deducted from the wallet-balance when sendtoaddress is used. Just tested this, so it can be confirmed such is the case.
Perhaps the help text in bitcoin-cli should be updated to be more in line with the 'developer-reference'?
Also, for 'time', A Unix epoch time when the transaction was added to the wallet. Is this the same for both 'send' and 'receive' transactions? What is the definition of 'added' in this context? I'm not sure but I think bitcoin core needs 1 confirmation to make funds available (ie. showing in the balance). However, when I sent a small amount of testnetcoins to one of my nodes from a remote node, the 'time' and 'timereceived' is still the same, so I assume 'added to wallet' means that the transaction was added to the wallet the moment it was received, even if it sat at 0 confirmations.
But A Unix epoch time when the transaction was added to the wallet and A Unix epoch time when the transaction was detected by the local node seems to me to be equal statements?
In which scenarios would 'time' and 'timereceived' differ? I checked 'listtransactions' for a couple of test-nodes of mine (on different subnets), and 'time' and 'timereceived' always was equal, both for 'send' and 'receive' transactions.
It seems then that the only way 'time' and 'timereceived' could be non-equal was if the time of the block on the local best block chain that included the transaction determined the unix epoch time of the latter.