Вопрос

Date Comparission is not working in sharepoint sp services...I want to fetch records greaterthen equal to current year(ie 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>",
Это было полезно?

Решение

Try this

<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>

Другие советы

FYI I did a JavaScript API library for dealing with Sharepoint: http://aymkdn.github.io/SharepointPlus/

One of the good thing is that you don't need to worry anymore about the CAML Query. For example in your case you could do :

// 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"))
})

Note: you can check the browser console to check if there is any error

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top