[removed] How to parse date from UTC string and offset?

后端 未结 2 686
忘掉有多难
忘掉有多难 2021-01-23 07:38

Scenario

I have a UTC date in string format and an associated offset number in minutes:

  • Date: \"2017-10-01T12:00:00.000Z\"
  • Offset
2条回答
  •  情歌与酒
    2021-01-23 08:17

    Is that what you need ?

    const moment = require('moment');
    moment
      .utc('2013-06-20T07:00:00.427')
      .zone(-360)
      .format();
    

    here you'll find a lot of displaying options -> http://momentjs.com/docs/#/displaying/

    or maybe just:

    const date = new Date('2017-10-01T12:00:00.000Z');
    date.setMinutes(-360);
    date.toISOString();
    

提交回复
热议问题