Post
Topic
Board Beginners & Help
Re: Parsing unix timestamp from CLI response with jq
by
rpstatic
on 20/07/2018, 07:50:28 UTC
Not sure if you can use this but if you simply want to convert that to a readable date, you can use:

Code:
date -d @1440604784 +'%d.%m.%Y'

The output would be:

26.08.2015

Thank you. I used another approach, but your idea helped me to find the right solution for my issue.

e.g. (output truncated):
Code:
bitcoin-cli listtransactions | jq '.[].time |=(. | strftime("%Y-%m-%d"))'

Result:
Code:
{
  "txid": "5756ff16e2b9f881cd15b8a7e478b4899965f87f553b6210d0f8e5bf5be7df1d",
  "blockhash": "0000000000000000027d0985fef71cbc05a5ee5cdbdc4c6baf2307e6c5db8591",
  "blockheight": 371622,
  "confirmations": 160829,
  "time": "2015-08-26",
  "blocktime": 1440604784,
  "isCoinBase": true,
  "valueOut": 25.37726812,
  "size": 185
}