I have an array like below :
[
{
epochTime: 1609669500,
timeStamp: "2021-01-04 10:25",
value: 1.1790000371547649e-6
},
{
epochTime: 1609669800,
timeStamp: "2021-01-04 10:30",
value: 0.004326555113948416
},
{
epochTime: 1609675200,
timeStamp: "2021-01-04 12:00",
value: 0.0003694624756462872
},
{
epochTime: 1609751700,
timeStamp: "2021-01-04 09:15",
value: 41479433784.889
},
{
epochTime: 1609755600,
timeStamp: "2021-01-04 10:20",
value: 23963947008.0
},
{
epochTime: 1609758600,
timeStamp: "2021-01-04 11:10",
value: 27541368832.0
}
]
To display a graph, I want to group the data on an hourly basis : Ex- From the above input, I have data only for the 9th, 10th & 12th hour
something like below :
[
[1609751700, 2021-01-04 09:15, 41479433784.889], // for (9-10)th hour
.
.
.
[1609755600, 2021-01-04 10:20, 23963947008.0], // for (10-11)th hour
[1609669500, 2021-01-04 10:25, 1.1790000371547649e-6],
[1609669800, 2021-01-04 10:30, 0.004326555113948416],
.
.
.
[1609758600, 2021-01-04 11:10, 27541368832.0] // for (11-12)th hour
.
.
.
]
I tried something of this sort on each element of the array : Convert a Unix timestamp to time in JavaScript
But gives me the wrong EPOC to DateTime conversion