Post
Topic
Board Beginners & Help
Parsing unix timestamp from CLI response with jq
by
rpstatic
on 18/07/2018, 11:55:16 UTC
I would like to query data with the CLI and parse the response. I am using the terminal with jq for this.

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

My goal is to change the unix timestamps to another format and pipe the result to another command.

So, the block time should be changed from this
  "blocktime": 1440604784,                                                                                                                           

to this
  "blocktime": "18.07.2018"