Hi everyone,
I’m retrieving a list of upcoming (and ongoing) events:
date_default_timezone_set('Europe/London');
$now = new DateTime();
$events = tribe_get_events( array(
'eventDisplay' => 'upcoming',
'start_date' => $now->format('y-m-d H:i')
) );
$event = new DateTime(tribe_get_start_date( null, true, "y-m-d H:i:s"));
$end = new DateTime(tribe_get_end_date( null, true, "y-m-d H:i:s"));
For tribe_get_events(), the cutoff for an event is if its end_date is before the above start_date.
Now here is my problem. This is the output I get:
$now: 15-12-19 04:54
$event: 15-12-19 03:00
$end: 15-12-19 06:00
As soon as $now reaches 05:00, this event disappears, no longer gets retrieved by tribe_get_events(). It should be cut off at 06:00 (the end time), but cuts off at 05:00.
Now this may be because I’m working in a particular timezone, Europe/London, which has a +1 offset. If this is the case, how do we get the function to adhere to timezones?
If that’s not the issue, what could it be?
Thanks!