I am building a view for showing upcoming events.

I have my own content type with CCK field with format Date (Unix timestamp) and widget as Pop-up calendar. All works fine, but i views i don't know how to filter it out. I have shown the filter criteria in a screeshot and i don't know what to give in the value field.

enter image description here

2 Answers 2


In the value field you can use the PHP strtotime() function. So for example you select Is greater than and you put -7 days in the value field and your view will restrict to contents from 7 days ago.

Also a smoother solution for the end user is to expose this filter and they will be able to use a popup calendar to restrict the view.

  • i tried it and it did not work. The sql looks like AND (field_data_field_event_date.field_event_date_value >= '-7 days') . Is this fine ? Its taking it as text.
    – Hacker
    Commented Dec 12, 2011 at 6:47
  • I'm unable to reproduce your screenshot, I created a test field date timestamp and it display either a select list to choose a date or a relative field where I can put -7 days, see i.imgur.com/G0H8D.png Have you done any specific configuration ?
    – tostinni
    Commented Dec 12, 2011 at 19:40
  • I redid my configurations and now i am getting the options you said. Earlier there must be some problem.
    – Hacker
    Commented Dec 13, 2011 at 3:45

You need to activate the date_views module to see the filters appearing in the Views module interface.

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.