0

My Highcharts chart gets data with ajax. Java web-service generates data as list of objects, where time field looks like Jan 1, 1970 10:46:28 AM.

After downloading this json data by ajax, the time looks like the int value 27988000.

I want to properly show it on my x axis, so I need something like 10:46 values on my x axis.

My x axis description look like

xAxis: [{
    crosshair: true,
    type: 'datetime',
    dateTimeLabelFormats : {
        hour: '%b %e, %Y %H',
    }
}],

but, unfortunately, it shows incorrect time (7:46:28 instead of 10:46:28) How can I solve this?

Blundering Philosopher
  • 6,245
  • 2
  • 43
  • 59
Bogdan Timofeev
  • 1,062
  • 3
  • 11
  • 33
  • 1
    My initial reaction, as you stated its an exact number of hours behind what your expecting would be a localisation issue with date/time strings. See if anything in the following answer can help http://stackoverflow.com/questions/6525538/convert-utc-date-time-to-local-date-time-using-javascript alternatively HighCharts has a universal UTC option which may be interfering http://stackoverflow.com/questions/33367397/highcharts-tooltip-wrong-date – Simon West Oct 29 '15 at 15:29

1 Answers1

0

As Simon West mentioned, I only had to add the following:

 Highcharts.setOptions({
       global: {
            useUTC: false
       }
 });
Bogdan Timofeev
  • 1,062
  • 3
  • 11
  • 33