Convert UTC date to actual date and time
- by evann
I have a chart of bitcoin prices. I have the correct prices on the Y-axis, but I cannot get the correct time on the X-axis. The time shows up in a UTC format in my console. I am adding price and date to the series each iteration. I need to get the date of that particular result and find the YEAR, MONTH and DAY of that so I can put it in the right format. Any help is appreciated thanks.
$.ajax({
url: "/chart/ajax_get_chart", // the URL of the controller action method
dataType: "json",
type: "GET",
success: function (result) {
var result = JSON.parse(result);
series = [];
for (var i = 0; i < result.length; i++) {
tempArray = [parseFloat(result[i]['price'])];
tempDate = Date.parse(result[i]['date']);
series.push(tempDate);
series.push(tempArray);
}