向 Javascript 中的 UTC 日期添加偏移量
Add offset to UTC date in Javascript
我有 UTC 日期并想为其添加偏移量,比如 330 分钟。
var now = new Date();
var now_utc = new Date(now.getUTCFullYear(), now.getUTCMonth(), now.getUTCDate(), now.getUTCHours(), now.getUTCMinutes(), now.getUTCSeconds());
var offset = 330;
var new_date = ????
new_date = new Date((now_utc * 1) + (330*60*1000))
我有 UTC 日期并想为其添加偏移量,比如 330 分钟。
var now = new Date();
var now_utc = new Date(now.getUTCFullYear(), now.getUTCMonth(), now.getUTCDate(), now.getUTCHours(), now.getUTCMinutes(), now.getUTCSeconds());
var offset = 330;
var new_date = ????
new_date = new Date((now_utc * 1) + (330*60*1000))