0
votes

I am trying to retrieve data between two dates from SharePoint list using CAML javascript. I am getting the data if the two dates are in same month but if the two dates are in different months it is not retrieving any data. For eg. if the dates are 1-jan-2017 to 20-ja-2017 it is working of if the is 20-jan-2017 to 10-Feb-2017 it is not retrieving any data.which. I'm making any error in CAML query it seems.

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);
1
this question belongs to sharepoint.stackexchange.com, maybe try there - JohnPan

1 Answers

0
votes

You have to set the date in the format yyyy-MM-ddTHH:mm:ssZ or use SPUtility.CreateISO8601DateTimeFromSystemDateTime