{"id":1025042,"date":"2015-11-12T20:53:57","date_gmt":"2015-11-13T04:53:57","guid":{"rendered":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/problem-with-tribe_get_events-showing-events-earlier-than-its-start_date\/"},"modified":"2015-12-20T22:34:23","modified_gmt":"2015-12-21T06:34:23","slug":"problem-with-tribe_get_events-showing-events-earlier-than-its-start_date","status":"closed","type":"topic","link":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/problem-with-tribe_get_events-showing-events-earlier-than-its-start_date\/","title":{"rendered":"Problem with tribe_get_events() showing events earlier than its start_date"},"content":{"rendered":"<p>Hello all, <\/p>\n<p>Having a problem with tribe_get_events(). It retrieves an event which starts BEFORE start_date!<\/p>\n<p>Code:<\/p>\n<pre><code> &lt;?php \n      global $post;\n\t\t\t\t\n      $now = new DateTime(&#039;2015-11-13 21:05&#039;);\n      echo $now-&gt;format(&#039;y-m-d H:i&#039;) . &#039;&lt;br&gt;&#039;;\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       foreach ( $events as $post ) {\n           setup_postdata( $post );\n\n           $event = new DateTime(tribe_get_start_date( null, true, &quot;y-m-d H:i:s&quot;));\n           echo $event-&gt;format(&#039;y-m-d H:i:s&#039;);\n       } \n?&gt;<\/code><\/pre>\n<p>This is the output I get:<\/p>\n<pre><code>15-11-13 21:05\n15-11-13 21:00<\/code><\/pre>\n<p>I assign to $now a timestamp that&#8217;s AFTER the $event, and pass it to start_date.<br \/>\nYet the loop still picks up the $event, and displays it.<\/p>\n<p>Why is a loop which starts at 21:05 displaying an event which starts at 21:00?<\/p>\n<p>\/\/<\/p>\n<p>For eventDisplay I&#8217;ve tried custom, upcoming, all. No difference.<\/p>\n","protected":false},"template":"","class_list":["post-1025042","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>Problem with tribe_get_events() showing events earlier than its start_date -<\/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\/problem-with-tribe_get_events-showing-events-earlier-than-its-start_date\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Problem with tribe_get_events() showing events earlier than its start_date -\" \/>\n<meta property=\"og:description\" content=\"Hello all, Having a problem with tribe_get_events(). It retrieves an event which starts BEFORE start_date! Code: &lt;?php global $post; $now = new DateTime(&#039;2015-11-13 21:05&#039;); echo $now-&gt;format(&#039;y-m-d H:i&#039;) . &#039;&lt;br&gt;&#039;; $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;) ) ); foreach ( $events as $post ) { setup_postdata( $post ); $event = new [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/problem-with-tribe_get_events-showing-events-earlier-than-its-start_date\/\" \/>\n<meta property=\"article:modified_time\" content=\"2015-12-21T06:34:23+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\/problem-with-tribe_get_events-showing-events-earlier-than-its-start_date\/\",\"url\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/problem-with-tribe_get_events-showing-events-earlier-than-its-start_date\/\",\"name\":\"Problem with tribe_get_events() showing events earlier than its start_date -\",\"isPartOf\":{\"@id\":\"https:\/\/theeventscalendar.com\/support\/#website\"},\"datePublished\":\"2015-11-13T04:53:57+00:00\",\"dateModified\":\"2015-12-21T06:34:23+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/problem-with-tribe_get_events-showing-events-earlier-than-its-start_date\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/problem-with-tribe_get_events-showing-events-earlier-than-its-start_date\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/problem-with-tribe_get_events-showing-events-earlier-than-its-start_date\/#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\":\"Problem with tribe_get_events() showing events earlier than its start_date\"}]},{\"@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":"Problem with tribe_get_events() showing events earlier than its start_date -","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\/problem-with-tribe_get_events-showing-events-earlier-than-its-start_date\/","og_locale":"en_US","og_type":"article","og_title":"Problem with tribe_get_events() showing events earlier than its start_date -","og_description":"Hello all, Having a problem with tribe_get_events(). It retrieves an event which starts BEFORE start_date! Code: &lt;?php global $post; $now = new DateTime(&#039;2015-11-13 21:05&#039;); echo $now-&gt;format(&#039;y-m-d H:i&#039;) . &#039;&lt;br&gt;&#039;; $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;) ) ); foreach ( $events as $post ) { setup_postdata( $post ); $event = new [&hellip;]","og_url":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/problem-with-tribe_get_events-showing-events-earlier-than-its-start_date\/","article_modified_time":"2015-12-21T06:34:23+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\/problem-with-tribe_get_events-showing-events-earlier-than-its-start_date\/","url":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/problem-with-tribe_get_events-showing-events-earlier-than-its-start_date\/","name":"Problem with tribe_get_events() showing events earlier than its start_date -","isPartOf":{"@id":"https:\/\/theeventscalendar.com\/support\/#website"},"datePublished":"2015-11-13T04:53:57+00:00","dateModified":"2015-12-21T06:34:23+00:00","breadcrumb":{"@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/problem-with-tribe_get_events-showing-events-earlier-than-its-start_date\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/theeventscalendar.com\/support\/forums\/topic\/problem-with-tribe_get_events-showing-events-earlier-than-its-start_date\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/problem-with-tribe_get_events-showing-events-earlier-than-its-start_date\/#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":"Problem with tribe_get_events() showing events earlier than its start_date"}]},{"@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\/1025042","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\/1025042\/revisions"}],"predecessor-version":[{"id":1025064,"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/topic\/1025042\/revisions\/1025064"}],"wp:attachment":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/media?parent=1025042"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}