13

I have a content type with a date field. I need to output them grouping by year, i.e.

2011

- nodeA 2011-09-01
- nodeB 2011-01-29

2010

- nodeC 2010-12-08

How can I do that?

3 Answers 3

16
  1. Add a second date field to the view.
  2. In the configuration of that field

    1. Configure the field to only display the year
    2. Exclude the field from display
  3. In the format settings of the view, group by this field.

5
  • 3
    I've already tried this one and it doesn't work. Apparently, the grouping goes over VALUES, not the output of a field. Sep 11, 2011 at 20:23
  • Are you rewriting the field, or using a pre-configured date format? The former will not work, but the latter definitely does. Sep 11, 2011 at 20:40
  • 1
    Field is displayed in a "Year" format (Y), then in format settings it is set as a "grouping field". However the year is shown above each row, even when I set the dates to be exactly the same (sic!). My field exact type is "Date (ISO format)" - maybe that is wrong? Sep 12, 2011 at 21:46
  • See cdmo's comment below...
    – jay-ess
    Jun 3, 2013 at 21:37
  • 2
    This almost worked for me as well, but I did need to follow the additional step given in @cdmo's answer.
    – joe_flash
    Mar 23, 2015 at 21:57
16

@phils suggestion needs an update: just strip html for the field (in the Rewrite Results section). I can validate that this worked for me where @Oswald's solution did not.

1

Disable RDF-Module from Core.

Had the same problem and after searching for hours I finally stumpled upon this hint from KarenS: http://drupal.org/node/1253562#comment-4886998 Just disable the RDF-Module and maybe re-edit your date formats.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.