I have a SharePoint 2013 list in which I have a date field say Formatted Date, now using CAML Query I need to retrieve only the records which have year 2017 in the Formatted Date.PFB my code:
$().SPServices({
operation: "GetListItems",
listName:"Test List",
webURL:"http://ecf.pfizer.com/sites/Test/",
CAMLViewFields: '<ViewFields><FieldRef Name=\Region\'/><FieldRef Name=\FormattedDate\'/></ViewFields>',
CAMLQuery:"<Query><Where><And><Eq><FieldRef Name=\Region\'><Value Type='Choice'>"+region[i]+"</Value><Contains><FieldRef Name=\FormattedDate\'><Value Type='DateTime'>2017</Value></Contains></Eq></And></Where></Query>",
async: false,
completefunc: function (xData, Status)
{
year2016= parseInt($(xData.responseXML).SPFilterNode("rs:data").attr("ItemCount"));
}
But the count is retrieved as 0. Can somebody help? Thanks in advance