Hello
- My time zone is not correct, where do I have to install something for Zurich?
- The first time you call it up, the time is displayed with decimal places, is there a suitable correction here?
Hi.
By default, JavaScript will use the browser’s time zone.
How many hours is it deviated from the actual time?
As for the time in the axis, we’re using the default timestamp: https://api.highcharts.com/highstock/xAxis.dateTimeLabelFormats
Can you try using:
dateTimeLabelFormats: { minute: '%H:%M' }
instead of the following in the JavaScript file:
dateTimeLabelFormats: { second: '%H:%M:%S' }
And see if it shows a more suitable time format?
Regards,
Sara
Hello
I made this change but the result is the same. The X-axis time is still an hour behind. Also the timestamp goes back one hour. It is the same on the PC as on the smartphone.
My time zone setting is:
(UTC+01:00) Amsterdam, Berlin, Bern, Rome, Stockholm, Vienna
Hi.
I’m not sure why, but you probably need to adjust the time manually in the JavaScript code.
Here’s the code with UTC+01:00: https://gist.github.com/sarasantos/2b735d24b901e5ce36d0008dbe3c5505
Let me know if this code works for you.
Basically, create a new prototype addHours() to add how many hours you want to the UTC:
Date.prototype.addHours= function(h){
this.setHours(this.getHours()+h);
return this;
}
Then, simply use it on the Date() objects like this to add an hour:
var x = new Date().addHours(1).getTime();
Regards,
Sara
Hello
Thanks for the tip, it works. My son has suggested another solution to me, which also works, see link:
https://api.highcharts.com/highcharts/time.getTimezoneOffset
https://jsfiddle.net/gh/get/library/pure/highcharts/highcharts/tree/master/samples/highcharts/time/gettimezoneoffset/
Greetings
Helmut
Hi.
Thanks for sharing that.
That’s a better solution as it uses the highcharts JS API.
Regards,
Sara