如何从当前日期获取jquery中的日期范围,我在java中完成了以下操作,需要在jquery中复制它
Datetime sixMonthsFromNow = Datetime.now().addMonths(-6);
sortByQueryString = '&fq=lastmodified:['+sixMonthsFromNow.format('yyyy-MM-dd\'T\'hh:mm:ss\'Z\'')+'+TO+NOW]';
答案 0 :(得分:4)
这段代码的Javascript样式(不需要jQuery):
var now = new Date();
var sixMonthsFromNow = new Date(now.setMonth(now.getMonth() - 6));
var sortByQueryString =
'&fq=lastmodified:[' + sixMonthsFromNow.toISOString() + '+TO+NOW]';
// &fq=lastmodified:[2013-11-27T08:57:10.089Z+TO+NOW]