How to set JS standard time in Moscow?

  • 0
    As I know, you can set a specific time zone on the server, I have a time zone set in Moscow time.
    But I have +2 hours relative to Moscow, I made a countdown timer, but since the JS time is local, that is, relative to the user, the timer does not work correctly for me.
    Is it possible to somehow set the JS time by MSK, and if so, how?
    JavaScript Adelaide Harding, May 15, 2020

  • 2 Answers
  • 0
    new Date(Date.parse('2020-10-30T10:00:00.000Z')); // Добавит таймзону
    new Date(Date.parse('2020-10-30T10:00:00.000')); // Не добавит таймзону
    Anonymous

  • 0
    function getMoscowDate() {
    var offset = +3;
    return new Date(new Date().getTime() + offset * 3600 * 1000).toUTCString().replace(/ GMT$/, "");
    }
    console.log(getMoscowDate());
    Anonymous

Your Answer
To place the code, please use CodePen or similar tool. Thanks you!