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?


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.

| 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
  • paste this in your CAML Query iso.ToString("s") – Raf Dec 11 '19 at 4:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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