I have a list of arrays as [x,y] for Highcharts. My x-values are timestamps in the format 2013-04-30 00:04:00
.
Here\'s an example of the Highchart options:
Those are almost ISO date strings which would look like "2013-04-03T00:00:00" and the Date(string)
constructor can take ISO strings.
In Chrome this works. (If you add the Z on the end, its taken as UTC time. If you leave it off, its taken as local time. There are strings to append for the various time zones if you need that.)
var d = '2013-04-30 00:00:00Z';
var date = new Date(d);
In FireFox and IE9 you have to add the 'T'. (as in 2013-04-30T00:00:00Z)
So you can use this in all three:
var d = '2013-04-30 00:00:00';
var date = new Date(d.replace(' ', 'T') + 'Z')
Here's a fiddle: FIDDLE HERE
yes you can go with UNIX timestamp I mean the timestamp in milliseconds. highcharts accept them as direct integer input for date-time type of x-Axis.
ex: 30/04/2013 00:00:00:000 = 1367260200000
you can pass this value like
data: [[1367260200000, 30],[1367260260000, 32], ....]
Hope this will be of your use.