Time zone OffsetFrom 1.2.0, deprecated 2.9.0+
moment().zone();
moment().zone(Number|String);
Note: This function has been deprecated in 2.9.0. Consider moment.fn.utcOffset
instead.
Get the time zone offset in minutes.
moment().zone(); // (60, 120, 240, etc.)
As of version 2.1.0, it is possible to set the offset by passing in the number of minutes offset from GMT.
moment().zone(120);
If the input is less than 16
and greater than -16
, it will interpret your input as hours instead.
// these are equivalent
moment().zone(480);
moment().zone(8);
It is also possible to set the zone from a string.
moment().zone("-08:00");
moment#zone
will search the string for the first match of +00:00 +0000 -00:00 -0000
, so you can even pass an ISO8601 formatted string and the moment will be changed to that zone.
moment().zone("2013-03-07T07:00:00-08:00");
当前内容版权归 momentjs.com 或其关联方所有,如需对内容或内容相关联开源项目进行关注与资助,请访问 momentjs.com .