Sorting by Date in Views

I recently came across a small problem with sorting views by date. Not by any Node associated date (such as Publish Date, or Update Date), but sorting by a Date Field, as supplied by the Date module. I was trying to sort the content by the date field, descending, but what I was getting was all sorts of garbled mess, at which point I noticed that there was no granularity setting when adding the field to the Sort list.
Enter: Arguments.

The simple solution in my case was to click the + button to add an argument, then add the same field to the argument. I left everything as default (Title and Breadcrumb as blank, because the title is set elsewhere and I'm not using breadcrumbs) and just changed "Action to take if argument is not present" to "Display all values" and "Granularity" to month.
I also left the same field in the Sort section of the view (sorting by descending) and presto! A view sorted by Date field :)

Add new comment

Restricted HTML

  • Allowed HTML tags: <a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id>
  • Lines and paragraphs break automatically.
  • Web page addresses and email addresses turn into links automatically.