我从列表中检索项目时遇到一些问题,程序应该检索用户提供的具有特定日期范围的项目列表。
以下是我的示例代码:
function getItems(startDate, endDate){
var query =
"<Query>" +
"<Where>" +
"<And>" +
"<Eq>" +
"<FieldRef Name='Date' /><Value Type='Date'>" + > startDate + "</Value>" +
"</Eq>" +
"<Eq>" +
"<FieldRef Name='Date' /><Value Type='Date'>" + < startDate + "</Value>" +
"</Eq>" +
"</And>" +
"</Where>" +
"<OrderBy>" +
"<FieldRef Name='Start' Ascending='false' />" +
"</OrderBy>" +
"</Query>";
$().SPServices......
}
答案 0 :(得分:0)
抱歉,我花了很多时间才弄明白,但我终于做到了。
function getItems(startDate, endDate){
var query =
"<Query>" +
<Where>" +
"<And>" +
"<Geq>" +
"<FieldRef Name=\"Start\" />" +
"<Value Type=\"DateTime\">" + fromdate + "</Value>" +
"</Geq>" +
"<Leq>" +
"<FieldRef Name=\"Start\" />" +
"<Value Type=\"DateTime\">" + todate + "</Value>" +
"</Leq>" +
"</And>" +
"</Where>" +
"<OrderBy>" +
"<FieldRef Name='Start' Ascending='false' />" +
"</OrderBy>" +
"</Query>";
$().SPServices......
}