使用MomentJS偏移:如何显示日期时间考虑与时区
var datetime = moment.tz("2016-08-16 21:51:28","Europe/London");
因为这种构造是知道的DST(夏令时),moment.js会自动添加+1小时偏移量。 datetime.format()
将显示:2016-08-16T21:51:28+01:00
。
但是,似乎打印日期时,未考虑该偏移量。例如。 datetime.format('DD.MM.YYYY - HH:mm:ss')
将显示:16.08.2016 - 21:51:28
但我不想显示:16.08.2016 - 22:51:28
(考虑1小时的DST偏移的时间)。有谁知道如何做到这一点?
看到这个小提琴。 http://jsfiddle.net/pe1gtbgj/另外。该文档可能有助于http://momentjs.com/guides/#/lib-concepts/date-time-math/ –