Get the UTC offset in minutes.

    Note: Unlike thisfunction returns the real offset from UTC, not the reverse offset (as returnedby Date.prototype.getTimezoneOffset).

    Getting the utcOffset of the current object:

    1. moment().utcOffset(); // (-240, -120, -60, 0, 60, 120, 240, etc.)

    If the input is less than and greater than -16, it will interpret your input as hours instead.

    1. moment().utcOffset(8); // set hours offset

    It is also possible to set the UTC offset from a string.

    moment#utcOffset will search the string for the first match of , so you can even pass an ISO8601 formatted string and the momentwill be changed to that UTC offset.

    1. moment().utcOffset("2013-03-07T07:00:00+08:00");

    The utcOffset function has an optional second parameter which accepts a boolean valueindicating whether to keep the existing time of day.

    • Passing will keep the same local time, but at the expense of choosing a differentpoint in Universal Time.