When I use CAML JavaScript to retrieve data from a SharePoint list between two dates, I encounter an issue. I am able to retrieve data successfully if the two dates fall within the same month, however, if the dates are in different months, no data is returned.
For example, if the dates are 1-jan-2017
to 20-jan-2017
, it works. But if the dates are 20-jan-2017
to 10-Feb-2017
, no data is retrieved. It seems like there may be an error in my CAML query.
camlQuery.set_viewXml("<View><Query><Where><And><And><Geq><FieldRef Name='Start_Date'/><Value IncludeTimeValue='false' Type='DateTime'>"+RDTA1+"</Value></Geq><Leq><FieldRef Name='Start_Date'/><Value IncludeTimeValue='false' Type='DateTime'>"+RDTA2+"</Value></Leq></And><Eq><FieldRef Name='Employee_Name' LookupId='true'/><Value Type='User'>"+current+"</Value></Eq></And></Where><OrderBy><FieldRef Name='Start_Date' Ascending='True'/></OrderBy></Query></View>");
this.collListItem = oList.getItems(camlQuery);