我指的是http://momentjs.com/timezone/docs/#/using-timezones/如何IST時區對象添加到Moment.js
在例子中,其給出如下位置:
moment.tz.add([
'America/Los_Angeles|PST PDT|80 70|0101|1Lzm0 1zb0 Op0',
'America/New_York|EST EDT|50 40|0101|1Lz50 1zb0 Op0'
]);
我不知道IST值作爲其給出:
{
name : 'America/Los_Angeles', // the unique identifier
abbrs : ['PDT', 'PST'], // the abbreviations
untils : [1414918800000, 1425808800000], // the timestamps in milliseconds
offsets : [420, 480] // the offsets in minutes
}
有人可以幫助添加IST對象嗎?
太謝謝你了! –
馬特,你還可以看看http://stackoverflow.com/questions/32267362/disabling-the-timezone-conversion-in-extjs/?上面的問題只是爲了解決這個問題,我認爲必須有一些更好的方法來做到這一點。謝謝! –
我不太瞭解ExtJS來回答這個問題,但我也不知道它與此有何關係。如果您有一個以UTC爲基礎的時間戳,只需使用'moment.utc(timestamp)'將其加載即可,並根據需要進行格式化。無需處理時區轉換。 –