[SOLVED][Drupal Views] How to pass a date via url to a Views contextual filter?

| | 1 min read

A Drupal user was a facing a peculiar situation in their Drupal site in which they had to show nodes greater than a particular date in one of their Views. They needed to pass a date via the URL to the Views contextual filter. If you are facing the same scenario in your Drupal site and want to know how to pass a date via URL to a Views Contextual filter then continue reading.

The solution is easy. You can pass the date using '--' operator in the URL. For eg. 20121210--20121213 will display all the content created between 10 Dec 2012 and 13 Dec 2012. You can also include an extra level of granularity by including the hour limit in the url. For eg. 012121310--2012121311 will display all the content created between 10am - 11am on the 13 Dec 2012.

Hope that helps.

The easiest way to solve a Drupal issue is to hand it to the Drupal experts. We can provide a wide range of Drupal services to help you maintain and manage your Drupal websites. Get in touch with us to know more.