{"id":1044121,"date":"2015-12-19T06:46:03","date_gmt":"2015-12-19T14:46:03","guid":{"rendered":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/getting-tribe_get_events-to-work-with-timezones-2\/"},"modified":"2016-02-18T08:33:18","modified_gmt":"2016-02-18T16:33:18","slug":"getting-tribe_get_events-to-work-with-timezones-2","status":"closed","type":"topic","link":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/getting-tribe_get_events-to-work-with-timezones-2\/","title":{"rendered":"Getting tribe_get_events() to work with timezones"},"content":{"rendered":"<p>Hi everyone,<\/p>\n<p>I\u2019m retrieving a list of upcoming (and ongoing) events:<\/p>\n<pre><code>date_default_timezone_set(&#039;Europe\/London&#039;); \n \n$now = new DateTime();\n \n$events = tribe_get_events( array(\n    &#039;eventDisplay&#039;   =&gt; &#039;upcoming&#039;,\n    &#039;start_date&#039; =&gt; $now-&gt;format(&#039;y-m-d H:i&#039;)\n) );\n \n$event = new DateTime(tribe_get_start_date( null, true, &quot;y-m-d H:i:s&quot;));\n$end = new DateTime(tribe_get_end_date( null, true, &quot;y-m-d H:i:s&quot;));<\/code><\/pre>\n<p>For tribe_get_events(), the cutoff for an event is if its end_date is before the above start_date.<\/p>\n<p>Now here is my problem. This is the output I get:<\/p>\n<pre><code>$now: 15-12-19 04:54\n$event: 15-12-19 03:00\n$end: 15-12-19 06:00<\/code><\/pre>\n<p>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.<\/p>\n<p>Now this may be because I\u2019m 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?<\/p>\n<p>If that\u2019s not the issue, what could it be?<\/p>\n<p>Thanks!<\/p>\n","protected":false},"template":"","class_list":["post-1044121","topic","type-topic","status-closed","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v25.2 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Getting tribe_get_events() to work with timezones -<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/getting-tribe_get_events-to-work-with-timezones-2\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Getting tribe_get_events() to work with timezones -\" \/>\n<meta property=\"og:description\" content=\"Hi everyone, I\u2019m retrieving a list of upcoming (and ongoing) events: date_default_timezone_set(&#039;Europe\/London&#039;); $now = new DateTime(); $events = tribe_get_events( array( &#039;eventDisplay&#039; =&gt; &#039;upcoming&#039;, &#039;start_date&#039; =&gt; $now-&gt;format(&#039;y-m-d H:i&#039;) ) ); $event = new DateTime(tribe_get_start_date( null, true, &quot;y-m-d H:i:s&quot;)); $end = new DateTime(tribe_get_end_date( null, true, &quot;y-m-d H:i:s&quot;)); For tribe_get_events(), the cutoff for an event is if its [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/getting-tribe_get_events-to-work-with-timezones-2\/\" \/>\n<meta property=\"article:modified_time\" content=\"2016-02-18T16:33:18+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/getting-tribe_get_events-to-work-with-timezones-2\/\",\"url\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/getting-tribe_get_events-to-work-with-timezones-2\/\",\"name\":\"Getting tribe_get_events() to work with timezones -\",\"isPartOf\":{\"@id\":\"https:\/\/theeventscalendar.com\/support\/#website\"},\"datePublished\":\"2015-12-19T14:46:03+00:00\",\"dateModified\":\"2016-02-18T16:33:18+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/getting-tribe_get_events-to-work-with-timezones-2\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/getting-tribe_get_events-to-work-with-timezones-2\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/getting-tribe_get_events-to-work-with-timezones-2\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/theeventscalendar.com\/support\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Topics\",\"item\":\"https:\/\/theeventscalendar.com\/support\/topics\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Calendar Products\",\"item\":\"https:\/\/theeventscalendar.com\/support\/forums\/forum\/events\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Events Calendar PRO\",\"item\":\"https:\/\/theeventscalendar.com\/support\/forums\/forum\/events\/events-calendar-pro\/\"},{\"@type\":\"ListItem\",\"position\":5,\"name\":\"Getting tribe_get_events() to work with timezones\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/theeventscalendar.com\/support\/#website\",\"url\":\"https:\/\/theeventscalendar.com\/support\/\",\"name\":\"\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/theeventscalendar.com\/support\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Getting tribe_get_events() to work with timezones -","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/getting-tribe_get_events-to-work-with-timezones-2\/","og_locale":"en_US","og_type":"article","og_title":"Getting tribe_get_events() to work with timezones -","og_description":"Hi everyone, I\u2019m retrieving a list of upcoming (and ongoing) events: date_default_timezone_set(&#039;Europe\/London&#039;); $now = new DateTime(); $events = tribe_get_events( array( &#039;eventDisplay&#039; =&gt; &#039;upcoming&#039;, &#039;start_date&#039; =&gt; $now-&gt;format(&#039;y-m-d H:i&#039;) ) ); $event = new DateTime(tribe_get_start_date( null, true, &quot;y-m-d H:i:s&quot;)); $end = new DateTime(tribe_get_end_date( null, true, &quot;y-m-d H:i:s&quot;)); For tribe_get_events(), the cutoff for an event is if its [&hellip;]","og_url":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/getting-tribe_get_events-to-work-with-timezones-2\/","article_modified_time":"2016-02-18T16:33:18+00:00","twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/getting-tribe_get_events-to-work-with-timezones-2\/","url":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/getting-tribe_get_events-to-work-with-timezones-2\/","name":"Getting tribe_get_events() to work with timezones -","isPartOf":{"@id":"https:\/\/theeventscalendar.com\/support\/#website"},"datePublished":"2015-12-19T14:46:03+00:00","dateModified":"2016-02-18T16:33:18+00:00","breadcrumb":{"@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/getting-tribe_get_events-to-work-with-timezones-2\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/theeventscalendar.com\/support\/forums\/topic\/getting-tribe_get_events-to-work-with-timezones-2\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/getting-tribe_get_events-to-work-with-timezones-2\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/theeventscalendar.com\/support\/"},{"@type":"ListItem","position":2,"name":"Topics","item":"https:\/\/theeventscalendar.com\/support\/topics\/"},{"@type":"ListItem","position":3,"name":"Calendar Products","item":"https:\/\/theeventscalendar.com\/support\/forums\/forum\/events\/"},{"@type":"ListItem","position":4,"name":"Events Calendar PRO","item":"https:\/\/theeventscalendar.com\/support\/forums\/forum\/events\/events-calendar-pro\/"},{"@type":"ListItem","position":5,"name":"Getting tribe_get_events() to work with timezones"}]},{"@type":"WebSite","@id":"https:\/\/theeventscalendar.com\/support\/#website","url":"https:\/\/theeventscalendar.com\/support\/","name":"","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/theeventscalendar.com\/support\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"}]}},"_links":{"self":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/topic\/1044121","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":1,"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/topic\/1044121\/revisions"}],"predecessor-version":[{"id":1044828,"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/topic\/1044121\/revisions\/1044828"}],"wp:attachment":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/media?parent=1044121"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}