我正在使用尝试这个jQuery 日期时间选择器 http://trentrichardson.com/examples/timepicker/获取日期和时间数据。
我能够得到大部分内容(格式、显示等)。但是,我无法获取 UTC 格式的日期和时间。我只能获取本地格式的日期和时间。
有谁知道如何修改它来获取日期和时间?
或者删除弹出窗口中的“立即”按钮?
我今天遇到了同样的问题,并找到了这个旧线程。单击“立即”按钮时,您可以覆盖 $.datepicker._gotoToday 以使用 UTC 时间。
//make the now button go to "now" in utc, not local
$.datepicker._gotoToday = function(id) {
var inst = this._getInst($(id)[0]),
$dp = inst.dpDiv;
this._base_gotoToday(id);
var tp_inst = this._get(inst, 'timepicker');
//removed -> selectLocalTimeZone(tp_inst);
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();
};
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)