Support

Home Forums Event Espresso Premium how to get events list, filter by duration?

how to get events list, filter by duration?

Posted: January 5, 2016 at 4:26 am


netpowerdev

January 5, 2016 at 4:26 am

Hi all,

I have an issue to get the list of events by duration (DTT_EVT_end – DTT_EVT_start).
I’m using this function
$events = EE_Registry::instance()->load_model( ‘Event’ )->get_all( array(
$where,
‘limit’ => ‘0,10’,
‘order_by’ => ‘Datetime.DTT_EVT_start’,
‘order’ => ‘ASC’,
‘group_by’ => ‘EVT_ID’
));
How can I add the custom query like that in where clause:
“DATEDIFF(Datetime.DTT_EVT_end,Datetime.DTT_EVT_start) >= 1”

Thanks


Josh

  • Support Staff

January 6, 2016 at 3:10 pm

Hi there,

It turns out that you have to use the “having” clause instead of “where” because “date_diff” isn’t available during the query.

Sample code follows:


netpowerdev

January 7, 2016 at 9:42 pm

Thanks Josh,
That’s all what I want. 🙂

The support post ‘how to get events list, filter by duration?’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Event Espresso