Javascript Moment.js,将UTC日期更改为给定的UTC偏移量
我从后端接收到2个值Javascript Moment.js,将UTC日期更改为给定的UTC偏移量,javascript,date,momentjs,Javascript,Date,Momentjs,我从后端接收到2个值 UTC日期2019-05-01T17:38:00Z UTC偏移值UTC+10,UTC-2 我需要根据偏移值对日期进行加减。使用矩().utcOffset() 我有日期:2019-06-16T08:33:00Z时刻(日期)。format()=“2019-06-16T11:33:00+03:00”和时刻(日期)。utcOffset(+2)。format()=2019-06-16T11:33:00+03:00。日期和时间都一样 // these are equivalent mo
2019-05-01T17:38:00Z
李>
UTC+10
,UTC-2
李>
我需要根据偏移值对日期进行加减。使用矩().utcOffset()
我有日期:
2019-06-16T08:33:00Z
时刻(日期)。format()=“2019-06-16T11:33:00+03:00”
和时刻(日期)。utcOffset(+2)。format()=2019-06-16T11:33:00+03:00
。日期和时间都一样
// these are equivalent
moment().utcOffset("+08:00");
moment().utcOffset(8);
moment().utcOffset(480);