Score:0

Add granularity to entity query when sorting by a date field

na flag

I'm trying to get an entityQuery to sort nodes by a date field. I want to use hour granularity.

So, if some nodes' field_date values are set to the same hour, these nodes will be sorted alphabetically (by title).

$query = \Drupal::entityQuery('node')
  ->condition('status', 1)
  ->sort('field_date' , 'ASC') // I want this sort criteria to use hour granularity
  ->sort('title' , 'ASC');
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.