Posted by rcharamella on December 18, 2009 at 7:53pm
Hi all,
I've got a View that displays content types sorted by a date field. The Date field contains month, day and year. The sort works fine.
But I'd like to group the listings by Year. I can Group by the date field, but it doesn't give me enough granularity to specify the Year, only the whole date. This creates a "group" for each day. Is there a way that I can get the granularity that I need to group by year only?
Thanks in advance.
Comments
Solution
Thanks to Shifthappens for sending me this solution
Thanks! Here are the full steps
Excelent!
Thank you very much, the solution is really quick and simple. I was looking the way to group a list by date like this:
29/09/2011
1 Item
2 Item
3 Iten
28/09/2011
1 Item
2 Item
3 Item
And this solved my problem!
Greetings
Memoskins
Additional step for this to work in D7/Views3
This solution did not work for me with Views 3 in Drupal 7. It required the additional step of disabling the RDF module in Core, as recommended by KarenS: http://drupal.org/node/1253562#comment-4886998
Thx, csuggs4, after hours of
Thx, csuggs4, after hours of searching for a solution, disabling the RDF module worked for me.
Thanks
Thanks,
This solution works perfectly - thanks for updating your quesiton with the solution!
Just what I was looking for
Thank you very much agmin. I was reading this http://drupal.org/node/388140 and I couldn't believe that an easy solution wasn't possible. Override the date field output, write php... augh! To much for a rookie ;-) Thanks again.
The Easiest Solution.
The easiest solution is to add a date field to the "Fields" that are used in the View.
For example if you want to group by year, on the post dates of the content, add the Node: Post date field.
In its option choose to Exclude from display" So it won't be shown and set the "Date format" to Custom. Choose 'Y' (without quotes) for the format. It will then only output the year.
If you set the "Style" of the view to "HTML List" you can click the cog-wheel next to it and select a "Grouping field" from the Fields you added to the view. Select the Post date field and you'll see the view being grouped on that field.
Yes, but it seems to work
Yes, but it seems to work only with "native" date fields (like "post date field"), with some custom date fields, you have to disable the RDF module as suggested above. Thanks 4 giving me this suggestion!
Highcharts Module and groupby
I am using the highcharts module and I also would like to group my graph by month. However I can get it to group by day it will not group by month is there any reason why this might be happening ? I am using the date field but it doesnt seem to change anything when I just use month as my data I d appreciate any info that could help.
thanks