2

Drupal 7

I have a view that sorts on three fields so the ORDER BY statement looks like: ORDER BY

node_status ASC, field_data_field_date_field_date_value DESC, field_data_field_sort_order_field_sort_order_value ASC

I need the sort of the date field to not be granular to the time. I just want it sorted by the date so that the sort order field will take it from there. When I run the query against the database itself, I see that the date field returned is showing the full value like: 2016-06-19 08:48:12, but some of the values are different by a second, causing the "incorrect" (not the desired) sort order.

How can I get it to sort on the date field without the "full date" field?

EDIT: (adding screen shot of view) enter image description here

0

you can change the granularity of the sort under the settings for the sort criteria:

enter image description here

  • I don't see the settings to click on to get that. I added a screen shot of my view to my question. I do have it for the filter on date. – shelane Jun 19 '15 at 17:51
  • If you're using the Date Module, you can set the granularity in the Field Settings for that particular field – Geoff Jun 19 '15 at 18:23
  • It is a date field with the date module and the field is defined as only collecting month, day, and year. I wish I knew why I wasn't seeing what you see for those settings. – shelane Jun 19 '15 at 18:29
  • We have now done a work-around. We have rules applied when these items are published to set the date. It was getting set with "now" and I have changed it to "today" and it is just setting the field with the midnight time. – shelane Jun 19 '15 at 18:31
  • well, if it works... you aren't seeing what I posted because you didn't specify you were using the Date Field module, the image I posted is for core Post Date Field – Geoff Jun 19 '15 at 18:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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