Date Comparission在sharepoint sp服务中不起作用...我想获取等于当前年份(即2013年)的记录
CAMLQuery: "<Query><Where><Geq><FieldRef Name='EventDate' /></Value><Value Type='DateTime' IncludeTimeValue='TRUE'>2013-12-10T12:00:00Z</Value></Geq></Where><OrderBy><FieldRef Name='EventDate' /></OrderBy></Query>",
答案 0 :(得分:2)
试试这个
<Query><Where><Geq><FieldRef Name='EventDate' /><Value Type='DateTime' IncludeTimeValue='TRUE'>2013-12-10T12:00:00Z</Value></Geq></Where><OrderBy><FieldRef Name='EventDate' /></OrderBy></Query>
答案 1 :(得分:0)
仅供参考我为处理Sharepoint做了一个JavaScript API库:http://aymkdn.github.io/SharepointPlus/
其中一个好处是您不必再担心CAML查询了。例如,你可以这样做:
// define your date in JavaScript
// and use $SP().toSPDate() to convert it to the right format
var eventDate = $SP().toSPDate(new Date("2013/12/10"));
// call $SP().list().get() to get your data with the "where" parameter
$SP().list("Name of your list").get({
fields:"EventDate",
where:"EventDate >= '"+eventDate+"'",
orderby:"EventDate DESC"
}, function(data) {
for (var i=data.length; i--;) console.log(data[i].getAttribute("EventDate"))
})
注意:您可以检查浏览器控制台以检查是否有任何错误