user2843365 user2843365 - 1 year ago 215
JSON Question

HighCharts Date format

I have an application that returns JSON date to me which I display on a Highcharts bar graph. The field for the x-axis is a date and it comes back from the server is JSON format such as :"date":"2016-11-15T00:00:00.000Z"

I want to display the date on the x-axis as just 2016-11-15, or even better, display it in local date format, which in this case would be 2016-11-14 as it is GMT-5 hours.

I've read the documentation, but it doesn't seem to work. Any help is appreciated!!

Answer Source

You can parse ISO string date to js date with the Date constructor. And then get timestamp in milisecond - which is a required format for Highcharts.

new Date("2016-11-15T00:00:00.000Z").getTime(),

In the format property, you can define how the date should be displayed.

 xAxis: {
  type: 'datetime',
  labels: {
    format: '{value:%Y-%m-%d}',


For a local time, see useUTC option.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download