2014-12-04 50 views
0

我得到當前的時間戳。但是當我用jquery flot {mode:time}沒有正確給出時間

vat time= (resp.timestamp * 1000); 
data.push([time,value]); 
$.plot($(".memory"),[data],{xaxis: {mode: "time"}}); 

resp.timestamp是當前的時間戳。 我在GMT時間獲取x軸的時間,因爲我的本地時區是IST。我怎樣才能獲得當地時間? 即如果應用程序在印度運行,它應顯示IST時間,如果在澳大利亞運行AEST時間。

TRY1-

vat time= (resp.timestamp * 1000); 
data.push([time,value]); 
$.plot($(".memory"),[data],{xaxis: {mode: "time", timezone: "browser"}}); 

TRY2-

vat time= (resp.timestamp * 1000); 
data.push([time,value]); 
$.plot($(".memory"),[data],{xaxis: {mode: "time", timezone: "offset"}}); 

回答

0

我知道了。我從github複製jqquery.flot.time.js並將其粘貼到本地。

vat time= (resp.timestamp * 1000); 
    data.push([time,value]); 
    $.plot($(".memory"),[data],{xaxis: {mode: "time"}}); 

並使用相同的模式:「時間」。