var curTime = new Date(); console.log('curTime:', curTime) //curTime: Fri May 22 2020 19:23:17 GMT+0800 (中国标准时间) 1、加上1个小时
var addHour = curTime.setHours(curTime.getHours() + 1); console.log('addHour:', addHour) //addHour: 1590145897273 console.log(new Date(addHour))//Fri May 22 2020 19:11:37 GMT+0800 (中国标准时间) 2、在当前时间curTime变量上加上10分钟
var addMinute = new Date(curTime.setMinutes(curTime.getMinutes() + 10)); console.log('addMinute:', addMinute) //addMinute: Fri May 22 2020 19:21:37 GMT+0800 (中国标准时间) 3、在当前时间curTime变量上加上1分40秒(100秒), var addSeconds = new Date(curTime.setSeconds(curTime.getSeconds() + 100)); console.log('addSeconds:', addSeconds) //addSeconds: Fri May 22 2020 19:23:17 GMT+0800 (中国标准时间)