date highstock highchart

2019-08-08 11:21发布

问题:

can some one tell me how to read this date : [1113955200000,35.51], this code 1113955200000 gives me Tuesday apr 19 2005 any ideas ?????? what this numbers means and how to convert

$(function() {
$.getJSON('http://www.highcharts.com/samples/data/jsonp.php?filename=aapl-   c.json&callback=?', function(data) {

    // Create the chart

      window.chart = new Highcharts.StockChart({
        chart : {
            renderTo : 'container'
        },

        rangeSelector : {
            selected : 0
        },

        title : {
            text : 'TTm'
        },

        series : [{
            name : 'AAPL Stock Price',
            data :[[1113868800000,37.09],
[1113955200000,35.51],
[1114041600000,37.18],
[1114128000000,35.50],
[1114387200000,36.98],
[1114473600000,36.19],
[1114560000000,35.95],
[1114646400000,35.54],
[1114732800000,36.06]],
            type : 'area',
            threshold : null,
            tooltip : {
                valueDecimals : 2
            },
            fillColor : {
                linearGradient : {
                    x1: 0, 
                    y1: 0, 
                    x2: 0, 
                    y2: 1
                },
                stops : [[0, Highcharts.getOptions().colors[0]], [1, 'rgba(0,0,0,0)']]
            }

回答1:

That number is the Unix time (epoch time I think) in miliseconds. It is how javascript handles time values.

When passing values from your data to be added to the chart it may look like 01/01/1928 00:00:00. To get this into the appropriate format for HighCharts to use you can do (in javascript):

Date.parse('01/01/1928 00:00:00')


回答2:

Its an UNIX-style date, the number of milliseconds since a specific date (1-1-1970 00:00)
See epochconverter.com to quickly convert to human readable.
More info on wiki