如何获取当前时区偏移量(并正确格式化)?

How do I get the current timezone offset (and formatted it properly)?

如何使用 javascript 将计算机的时区偏移量格式化为这种格式:
<+/-><hourDiff>:<minuteDiff>,如 -7:00 (America/Los_Angeles)例如。

getTimezoneOffset returns a Number representing the time difference between UTC and Local Time, in minutes

var date = new Date();
var tzOffset = date.getTimezoneOffset();
var hours = ~~(tzOffset / 60);
var minutes = Math.abs(tzOffset % 60);
alert('Hours: ' + hours + ' Minutes: ' + minutes);