Order entries by custom time field I've got an events listings which works pretty well and there is a:


Custom Date field, eventEnd (just date)
Custom Start Time, eventStart (just time)
Custom End Time, eventEnd (just time)


I can list these entries so we list by date then time by using:

{% for entry in craft.entries.section('events').order('eventDate', 'eventStart').find() %}


but eventStart is ignored altogether, even when I would use:

{% for entry in craft.entries.section('events').order('eventStart').find() %}


I would expect:

Event 1: 14:00
Event 2: 15:00
Event 3: 16:00

but instead get something more random based I think on post date.

Suggestions welcome thank you!

UPDATE:

my biggest issue is actually being able to list by eventStart at all. Just using {{ eventStart }} reveals the current date. But if I try to boil down to just the hour, it's not a recognised way of ordering (even though it's just a set of numbers?)

So, I'm not sure where to head with this. I'm sure that if my start time was bundled in with the main date, all would be fine, but it makes the system a bit less obvious and flexible.

Here's what I've tried:

{% set completeeventlist = craft.entries.section('events') %}
{% for x in craft.entries(completeeventlist).order('eventDate') %}
&lt;ul&gt;
    {% set es = x.eventStart|date('H') %}
        {% for entry in craft.entries(x).order(es) %}
        &lt;li&gt;{{ entry.id }}{{ es }}&lt;/li&gt;
    {% endfor %}
&lt;/ul&gt;
{% endfor %}
Craft always saves a complete DateTime value to the database, even if you only make it set / show the time part of it in the Control Panel.

To ignore the date part (which in this case is set to the day you saved your entry) within the order parameter, you can make use of the time() MySQL function:

{% set entries = craft.entries.section('events').order('eventDate', 'time(eventStart)') %}