admin管理员组文章数量:1302985
I am trying to populate a graph using highstocks library. I am giving epoch time as input for x axis. I am able to generate the graph successfully but the problem is that the epoch time converted by highstock is mismatching with my time zone. For example
My input epoch time is : 1347497100000
Present result after convertion is: Thu, 13 Sep 2012 00:45:00 GMT
Expected result is : Wed Sep 12 2012 17:45:00 GMT-0700
This time zone mis match is the wrong value which is being displayed right now.
I tried setting this property also, but no luck:
global: {
useUTC: false
},
I am in pacific time zone. When I tried doing :
console.log(new Date)
from the same script, it returns me the time in pacific time.
Can you please advice how to fix the mismatch of this time zone ?
I am trying to populate a graph using highstocks library. I am giving epoch time as input for x axis. I am able to generate the graph successfully but the problem is that the epoch time converted by highstock is mismatching with my time zone. For example
My input epoch time is : 1347497100000
Present result after convertion is: Thu, 13 Sep 2012 00:45:00 GMT
Expected result is : Wed Sep 12 2012 17:45:00 GMT-0700
This time zone mis match is the wrong value which is being displayed right now.
I tried setting this property also, but no luck:
global: {
useUTC: false
},
I am in pacific time zone. When I tried doing :
console.log(new Date)
from the same script, it returns me the time in pacific time.
Can you please advice how to fix the mismatch of this time zone ?
Share Improve this question asked Sep 13, 2012 at 1:14 RaghuveerRaghuveer 1,4933 gold badges24 silver badges41 bronze badges 1- Here is the jsfidle link: jsfiddle/SLB4P/1 – Raghuveer Commented Sep 13, 2012 at 17:50
2 Answers
Reset to default 9It may be a good idea to read the global.useUTC api reference again
Global options that don't apply to each chart. These options, like the lang options, must be set using the Highcharts.setOptions method.
Highcharts.setOptions({
global: {
useUTC: false
}
});
What that means is the global property is not really applicable to any chart in particular and Highcharts
would blindly ignore the option even if you set it in an individual chart like
var chart=new Highcharts.StockChart({
{
...
global: {
useUTC: false
}
...
});
In short set the global option explicitly using the Highcharts.setOptions
method before you create any chart object
Local/Client Time Zone | Highchart & Highstock @ jsFiddle
Conversion problems are an extremely mon occurrence whenever dealing with date and time.
This link here shows the solution, to multiply by 1000, to get correct version.
Hope that helps.
本文标签: javascriptHighstocks epoch time mismatch with time zoneStack Overflow
版权声明:本文标题:javascript - Highstocks epoch time mismatch with time zone - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741734397a2394994.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论