I am able to filter for items created on a specific date with the following query (using today [03-06-2015] as an example):

"$filter=Created ge datetime'2015-03-06T05:00:00.000Z' and Created lt datetime'2015-03-07T05:00:00.000Z'"

But how do I check for dates that are NOT equal to today? I tried putting "not " before the first "Created" and wrapping the whole thing in parenthesis. I also tried putting "not" before the "ge" and "lt" operators.

Is this not possible to do without changing the query to the following?

"$filter=Created lt datetime'2015-03-06T05:00:00.000Z' or Created ge datetime'2015-03-07T05:00:00.000Z'"

Edit: I'm also noticing that not substringof(x,y) and substringof(x,y) eq false are also not working. For such a big push to REST calls, I'm not sure why there's so much that seems to have been forgotten or made very difficult to find.

  • Is this SP Online/O365 or is this on-prem? Filtering in REST does not behave exactly the same way on the two. Mar 7, 2015 at 20:40
  • This is on-prem
    – Dinerdo
    Mar 7, 2015 at 23:47

1 Answer 1


Since the original query:

$filter=Created ge datetime'<startdate>' and Created lt datetime'<enddate>'

includes all the items that have been created between startdate and enddate

the following query in opposite excludes items that have been created in this date interval:

$filter=Created lt datetime'<startdate>' or Created ge datetime'<enddate>'


/_api/web/lists/getbytitle('Pages')/items?$filter=Created lt datetime'2015-03-06T05:00:00.000Z' or Created ge datetime'2015-03-07T05:00:00.000Z'
  • Thank you for confirming, but I think this is the same example I used in my question. I was really just looking to know if there is a direct negation I could use for datetimes and substrings or if this was not possible.
    – Dinerdo
    Mar 7, 2015 at 23:48
  • 1
    Nope, it is not the same, the example the answer demonstrates how to return items that have been created NOT in the specified date interval Mar 7, 2015 at 23:54
  • 1
    Sorry.. it seems you are very much correct. I accidentally put an "and" in my example instead of an "or" though I had successfully been using it this way in my application. The example I listed would not return anything at all.
    – Dinerdo
    Mar 8, 2015 at 5:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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