2017-03-04 92 views
0

我得到UTC時間格式的當地時間,我需要改變它在browser.I的當地時間已經試過如下: -轉換UTC時間,瀏覽器

var start_time1= new Date(matchData.results[i].start_time); 

其中matchData.results[i].start_time是我的UTC時間,即ISODate("2017-03-09T03:30:00Z")

做上面我收到後:

09:00:00 GMT + 0530(IST)

但我要的是喜歡,如果本地瀏覽器的時間是上午9點,它給我相同,即上午9:00

+0

您需要在客戶方使用JavaScript來做到這一點。 – apokryfos

+0

結帳https://momentjs.com/ – apokryfos

回答

0

你只是嘗試:

var start_time1 = new Date("2017-03-09T03:30:00Z");

console.log(start_time1)

>>Thu Mar 09 2017 04:30:00 GMT+0100 (Paris, Madrid)

(我設在法國)