d = new Date(d.getFullYear(),d.getMonth(),d.getDate()-n);
方法二: 代码如下:var now = new Date();
now.setTime(now.getTime()-n*24*60*60*1000);