1

Initially, I have installed the Token module and created a Views block containing years.

I want to filter out the current year from the block (it should not show the current year).

In filter criteria, I have changed content:year ([current-date:custom:Y]), but it is not filtering the current year, and it is showing as follows:

  • 2013(3)
  • 2014(5)
  • 2015(6)
  • 2016(2)

I am expecting the output to be as follows:

  • 2013(3)
  • 2014(5)
  • 2015(6)

How can I achieve this? Any help is greatly appreciated.

0

1 Answer 1

0

You may want to check if using the Views Date Format SQL module could be a solution. Here are some quotes about it (from its project page):

... allows to format date fields using SQL.

The core functionality is to remove the date formatting from render() and put it in query(). I.e. format date values using SQL's DATE_FORMAT rather than PHP's format_date. This is achieved by assigning a new default handler to node 'created' and 'changed' date fields. This handler extends and overrides views's build in views_handler_field_date.

The UI is completely unobtrusive, only a single checkbox "Use SQL to format dates" is added to the handler configuration popup.

Your question is not about creating charts in Drupal, but you may want to refer to this comment also for an example of how we typically use it within the Charts module.

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.