I have a list of events (custom content type event) shown in a view.

There are several events each week. Each event has a date field, date, that records the date that the event will be held.

I would like to group the events by the week of the year that they occur. For example:

  • Next week
  • Two weeks from now
  • Three weeks from now
  • Four weeks from now

Is there a fancy way to compute the week using the date field and views grouping?


1 Answer 1


You can do this without using a PHP field (or similar). Those modules are usually bad practice to put PHP into the database like that.

You can create a date format in Drupal for 'Week'. Then you add the date field to the View and use this week format. That will output the value of the date as a week #. Then you group on that value.

A views filter can also help restrict the view to now + 4 weeks. And some views theming can make each week header be whatever you need it to be.

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.