Views variable for current date/year?

Events happening in the community are now at Drupal community events on www.drupal.org.
greta_drupal's picture

What is the correct syntax for referencing current date or date part for Node Post Date filter?

Example: Want to show ony nodes published prior to current year.

Date(Y) isn't valid.

Comments

It would be easier to achieve

liberatr's picture

It would be easier to achieve with arguments and the Date module, because that has a "granularity" setting, which you can set to Year.

Set Date filter to "greater

garethsprice's picture

Set Date filter to "greater than or equal to", then set the value to "-1 year".

Date filter uses PHP's strtotime() function, more examples at: http://php.net/strtotime

Orlando, FL Web Developer | http://www.garethsprice.com/

That will yield a date -1

greta_drupal's picture

That will yield a date -1 year from current date. Not what I want. I want it based on calendar year, not current date.

I believe the php strtotime()

liberatr's picture

I believe the php strtotime() function would understand "last year", though, if that's what you were after. You would still use the "less than / equal" operator.

(I still say views arguments, not filters, is the right answer to your question)

Florida

Group organizers

Group categories

Florida Topics

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: