Convert UTC date to actual date and time

Posted by evann on Stack Overflow See other posts from Stack Overflow or by evann
Published on 2013-06-27T15:38:53Z Indexed on 2013/06/27 16:21 UTC
Read the original article Hit count: 165

Filed under:
|
|

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);
              }

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about AJAX