I have a JSON response which includes unix timestamp in microseconds. I want to either: a. Add a field to the response so that it shows the date+time; or b. Change the field itself to be date+time.
Whichever is easier, but preferably a. The format I need is DD/MM/YYYY HH:MM:SS.ssssss
I was reviewing the following threads but I don't really understand them:
Convert UTC Epoch to local date
https://community.postman.com/t/convert-datetime-format-of-response-from-epoch-to-datetime/35320
https://learning.postman.com/docs/postman-flows/reference/working-with-date-and-time/
And I tried looking at FQL documentation but that was too in-depth too.
This is part of an example response:
"SequenceNumber": 230901153510049870,
"Trade": {
"LastPrice": 73.6,
"LastSize": 53798,
"Timestamp": 1693582510115510,
And I would like it to look something like:
"SequenceNumber": 230901153510049870,
"Trade": {
"LastPrice": 73.6,
"LastSize": 53798,
"Timestamp": 1693582510115510,
** "DateTime": 01/09/2023 15:35:10.115510,**
Full example output:
{
"ErrorCode": 0,
"Outcome": "Success",
"Ticks": [
{
"SequenceNumber": 230814040000019593,
"IsExtendedHour": false,
"Ask": null,
"Bid": null,
"Trade": {
"LastPrice": 74700.0,
"LastSize": 100,
"Timestamp": 1691985600000000,
"OptionalFields": {
"TradeId": "58850000",
"size": "100",
"price": "74700",
"style": "-1",
"type": "0",
"minorcurrencytype": "-1",
"currency": "964",
"marketsession": "0"
}
}
},
{
"SequenceNumber": 230814040000019591,
"IsExtendedHour": false,
"Ask": null,
"Bid": null,
"Trade": {
"LastPrice": 74700.0,
"LastSize": 200,
"Timestamp": 1691985600000000,
"OptionalFields": {
"TradeId": "58840000",
"size": "200",
"price": "74700",
"style": "-1",
"type": "0",
"minorcurrencytype": "-1",
"currency": "964",
"marketsession": "0"
}
}
}
],
"DepthOfBooks": []
}
In the following example, I'm looping through the parsed response updating the Timestamp before its consumed in the Visualizer.
I had to slice the timestamp to get it to show as you requested. (I'm still not sure what the last six digits are).
This produces the following in the Visualizer. (Please note, the time is showing my timezone, so its an hour out).