很简单哦
var now = new Date(new Date()-7*24*60*60*1000);
alert(now);
这个是当前时间,我测试已经更可以弹出了。
然后再用extjs格式化一下。
var end = now.format('Y-m-d H:i:s');
就可以了
没有Ext.Date.format()这个函数
var today = new Date();
today.setDate(parseInt(today.getDate()) - 7);
console.log(today.toLocaleString());
2013年12月12日 上午10:43:03
///获取当前日期(到秒)
var curDate = new Date()
//格式化;
var time=Ext.Date.format(curDate, 'Y-m-d');
///取7天前的时间
var now = new Date(new Date()-7*24*60*60*1000);
alert(now);
或
var today = new Date();
today.setDate(parseInt(today.getDate()) - 7);
console.log(today.toLocaleString());