0

I have created a view to filter comments by date range. For date range i am using between operator.

  • View type : Comment
  • Date : comment created (default field)

Issue : When i am trying to filter comment from 2015-11-01 to 2015-11-15

i am getting result from 2015-11-01 to 2015-11-14 only.

what i am missing ? may be some help me ?

1
  • You also can choose the between or equal to option. So, between excludes the outer value, where between or equal to includes the outer value. Commented Apr 15, 2016 at 18:05

1 Answer 1

1

Views uses in between operator i.e. BETWEEN min AND max expression.

enter image description here

This is equivalent to the expression (min <= expr AND expr <= max). Now the query that views create for date is:

(comment.created BETWEEN 1446336000 AND 1447545600)

Search for unix time value of 1447545600

The problem is with the date 2015-11-15, this is treated as 2015-11-15 00:00:00. So 2015-11-15 11:12:13 won't be included. Hope you get my point.

3
  • Means there is a bug in date range filter in Views. How can i resolve this ? Any suggestion ? Commented Apr 15, 2016 at 18:11
  • simply use the preferred date format (CCYY-MM-DD HH:MM:SS): 2015-11-15 23:59:59 Commented Apr 15, 2016 at 18:17
  • And no its not a bug. This is how mysql works. Just be precise. Added link for BETWEEN ... AND ... operator. Commented Apr 15, 2016 at 18:18

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.