尝试以下操作:
var date = new Date(2012, 12, 5, 18, 0, 0, 0);
var date_utc = new Date(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate(), date.getUTCHours(), date.getUTCMinutes(), date.getUTCSeconds());
该Date
功能可以通过以下方式使用:
var d = new Date();
var d = new Date(milliseconds);
var d = new Date(dateString);
var d = new Date(year, month, day, hours, minutes, seconds, milliseconds);
这取自此处的相关帖子:如何将 JavaScript 日期转换为 UTC?
要了解更多信息,请参阅:https ://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date