getting tribe_get_events() to work with timezones

Home Forums Calendar Products Community Events getting tribe_get_events() to work with timezones

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #1043899
    James
    Participant

    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!

    • This topic was modified 10 years, 4 months ago by James.
    • This topic was modified 10 years, 4 months ago by Geoff.
    #1044122
    James
    Participant

    Wrong thread, reposted in the events calendar pro forum. Please delete this thread.

    #1044888
    Geoff
    Member

    No worries, James! Closing this one out…

Viewing 3 posts - 1 through 3 (of 3 total)
  • The topic ‘getting tribe_get_events() to work with timezones’ is closed to new replies.