views:

162

answers:

1

Hi, in Drupal I have used CCK to add a datetime field to my custom data type. It inserts start date and end date fields. That is what I want. Now, I want Views to filter and show only the items that have the daterange (start date and end date) overlapping today's date. Any ideas on how to set it up on Views? What I think is strange is that the date fields of my custom content type don't seem to appear on the Views list when I am trying to add a filter. Thanks.

+1  A: 

You should enable the Date module, and use the Date specific filtering. It will work much easier for you than getting CCK Date to work.

Kevin
hum thanks, I will try that.
Marcos Buarque
Kevin, I am sorry to bother, but... can you give me some further instructions? I have added the drupal.org/project/date module which seems to be very complete. Is this the date module you are talking about? So you recommend I shouldn't add it to my custom content type using CCK? In the Views filter, which one should I pick? Thank you.
Marcos Buarque
Let me think... go add a new field to the content type that has a date, make it a Date type field. Set its properties, etc. Then in the view, you will have new filters under the Date category. This will get you up and running as far as ranges are concerned. It will let you use relative dates (+1 day, now, etc)
Kevin
Yes, that is it, I can see the relative dates filter. The thing is... My start date and end date filters are inside their fields and I want to use them to tell the system the start and end date... Do you know if I can use them as these parameters? Thanks.
Marcos Buarque
You could use them as Views arguments
Kevin
Hum, yes, I am trying to, but I am not figuring out how to complete the task... Does not seem to be simple. Maybe if I usecustom PHP code in the text box for that purpose...
Marcos Buarque
Basically, you can provide an Argument and give it a default value using PHP code. But you should be able to do this by adding a Date filter to the view against the date field and saying 'now' to pull only today's event(s). Or maybe I do not understand what you mean when you say overlapping todays date. For further examples, enable the Calendar module and look at its Views it provides.
Kevin