sortBy 'date' but specify which part of 'date'

Hey there,

I want to output a list and sort it by date. The date format of my articles is d-m-Y.

When using page('articles')->children()->sortBy('date', 'desc') the articles get ordered by day. What I want though is to have them sort by year.

Is there an easy way to do this in kirby?

Thanks
Jannis

See example here: Sorting | Kirby CMS

1 Like