Forum

Thread tagged as: Events

displaying todays events

I can't work out how to create what should be a simple filter for events.

This doesn't return anything.

                perch_events_custom(array(
                    'filter'=>'eventDateTime',
                    'match'=>'eq',
                    'value'=>date('Y-m-d'),
                    'sort'=>'eventDateTime',
                    'sort-order'=>'desc',
                    'template'=>'listing/banner-listing.html'
                ));

'match'=>'gte' displays todays events and, of course, future events.

John Liston

John Liston 0 points

  • 6 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

The time is included, so you need to filter between 00:00:00 and 23:59:59

Yes, I tried that but I've probably got the syntax wrong because this returns everything!

perch_events_custom(array(
                    'filter'=>'eventDateTime',
                    'match'=>'between',
                    'value'=>date('Y-m-d 00:00:00'), date('Y-m-d 23:59:59'),
                    'sort'=>'eventDateTime',
                    'sort-order'=>'desc',
                    'template'=>'listing/banner-listing.html'
                ));
Drew McLellan

Drew McLellan 2638 points
Perch Support

Try:

'match' => 'eqbetween',
'value' => date('Y-m-d 00:00:00'). ', ' . date('Y-m-d 23:59:59'),

Perfect. I tried various combinations but not that one! Thank you Drew.