4

How can I return items filtered by date or date interval? I was trying something like this based on the filtering example from eve's documentation:

/records/?where={"date": {"$gte": "2016-10-17"}}

I was thinking this python syntax could work too by checking this comment in eve's request parsing code:

/records/?where=date==datetime('2016-10-16')

But the result is 500 internal error, maybe the syntax is wrong. I'm having a hard time getting it right.

Thanks.

gcw
  • 1,639
  • 1
  • 18
  • 37

1 Answers1

2

Try this:

/records?where={"date": {"$gt": "Mon, 17 Oct 2016 03:00:00 GMT"}}

It uses the DATE_FORMAT setting which defaults to RFC1123.

Nicola Iarocci
  • 6,606
  • 1
  • 20
  • 33
  • Thank you for the answer Nicola. Since I'm using `DATE_FORMAT` as `'%d/%m/%Y %H:%M:%S %z'` I've tried querying with this format using `/records/?where={"date": {"$gte": "17/10/2015 00:00:00 -0200"}}` and it worked! – gcw Oct 20 '16 at 01:12