我指的是http://momentjs.com/timezone/docs/#/using-timezones/
例如,它提供了以下位置的示例:
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对象添加到这个代码中吗?
moment.utc(timestamp)
将其加载到moment中,并按所需格式进行格式化。无需处理时区转换。 - Matt Johnson-Pint(5 * 60) + 30
(5小时,每小时60分钟,再加上30分钟) - Matt Johnson-Pint