I are using jquery-ui-timpicker-addon.js.我必须以格林威治标准时间而不是本地时间设置时区。在下面的代码中,我可以更改 GMT 中的时间,但日期没有相应地更新。请让我知道
$.datepicker._gotoToday = function (id) {
var inst = this._getInst($(id)[0]), $dp = inst.dpDiv;
this._base_gotoToday(id);
var tp_inst = this._get(inst, 'timepicker');
var now = new Date();
var now_utc = new Date(now.getUTCFullYear(), now.getUTCMonth(), now.getUTCDate(), now.getUTCHours(), now.getUTCMinutes(), now.getUTCSeconds());
this._setTime(inst, now_utc);
$('.ui-datepicker-today', $dp).click();
//this._setTime(inst, now_utc);
//$('.ui-datepicker-today', $dp).click();
$(id).datepicker('setDate', new Date(now_utc.getTime()));