function removeDaysToDate(date, hours){ var res = new Date(date); console.log('res ->' + res); console.log('hours ->' + hours); res.setHours(res.getHours() - hours); console.log('updated res ->' + res); return res; }