Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I'm trying to get the filtered results by a column type DateTime from a list filled with BCS using JavaScript.
I've tried everything to get those results with query like:

"<Where>" +
    "<Geq>" +
        "<FieldRef Name='Fecha'/>" +
            "<Value IncludeTimeValue='FALSE' Type='DateTime'>" +
                "3/12/2013" +
            "</Value>" +
    "</Geq>" +
"</Where>" +

also removing the IncludeTimeValue='FALSE'.
Does someone know the correct syntax for this query?
Or is it a known issue?

share|improve this question

1 Answer 1

Your datetime has to be converted into ISO8601 format. See another question about it (but in server side).

So, your date has to have the format: 2013-03-12T00:00:00.000Z

In javascript you can do this:

var date = new Date(2013, 3 - 1, 12); //months are zero based
var iso = date.toISOString();

then iso string can be in the caml query.

I would also recommend the MIT licenced momentjs for parsing, processing, comparing and formating dates in javascript, and Ms-PL licensed camljs for creating complex (and simple of course) caml queries.

share|improve this answer
    
I've already tried the ISO format, but it just doesn't filter them. Those JavaScripts might be useful, i will try them. Thanks for the help. –  lostuser23 Mar 26 '13 at 20:04

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.