Title: Error: Incorrect DATETIME value &#8230;. SELECT SQL_CALC_FOUND_ROWS
Last modified: June 25, 2025

---

# Error: Incorrect DATETIME value …. SELECT SQL_CALC_FOUND_ROWS

 *  Resolved [Guyinpv](https://wordpress.org/support/users/guyinpv/)
 * (@guyinpv)
 * [11 months, 2 weeks ago](https://wordpress.org/support/topic/error-incorrect-datetime-value-select-sql_calc_found_rows/)
 * This issue has come up before in the forums but there is no clear solution about
   it yet.
 * The full error is:
 *     ```wp-block-code
       WordPress database error Incorrect DATETIME value: '' for query SELECT SQL_CALC_FOUND_ROWS  (wp_tec_occurrences.occurrence_id + 10000000) as occurrence_idFROM wp_posts LEFT JOIN wp_postmeta ON ( wp_posts.ID = wp_postmeta.post_id AND wp_postmeta.meta_key = '_EventHideFromUpcoming' )JOIN wp_tec_occurrences ON wp_posts.ID = wp_tec_occurrences.post_idWHERE 1=1  AND (wp_tec_occurrences.start_date > ''ANDwp_postmeta.post_id IS NULL) AND wp_posts.post_type = 'tribe_events' AND ((wp_posts.post_status = 'publish' OR wp_posts.post_status = 'private')) AND (wp_posts.ID NOT IN (22653))GROUP BY wp_tec_occurrences.occurrence_idORDER BY wp_tec_occurrences.start_date ASC, wp_posts.post_date ASCLIMIT 0, 1made by require('wp-blog-header.php'), require_once('wp-includes/template-loader.php'), include('/plugins/the-events-calendar/src/views/v2/default-template.php'), Tribe\Events\Views\V2\Template_Bootstrap->get_view_html, Tribe\Events\Views\V2\Template_Bootstrap->get_v1_single_event_html, tribe_get_view, include('/themes/child-theme/tribe-events/single-event.php'), tribe_the_next_event_link, tribe_get_next_event_link, Tribe__Events__Adjacent_Events->get_next_event_link, Tribe__Events__Adjacent_Events->get_event_link, Tribe__Events__Adjacent_Events->get_closest_event, WP_Query->get_posts, apply_filters_ref_array('posts_pre_query'), WP_Hook->apply_filters, TEC\Events\Custom_Tables\V1\WP_Query\Modifiers\Events_Only_Modifier->filter_posts_pre_query, TEC\Events\Custom_Tables\V1\WP_Query\Custom_Tables_Query->get_posts, WP_Query->get_posts, QM_DB->query
       ```
   
 * This error always happens twice in a row.
 * It’s already been discovered that it is related to functions for get_next_event_link
   and get_prev_event_link.
 * Here is the new information I’ve discovered about this from my side. This error
   ONLY happens when a link is opened with a certain format for a venue.
 * Normally a venue URL would look something like this: `/venue/venue-name`. This
   does not cause the error to happen. But sometimes a link is used that looks like
   this:
   `/?eventDisplay=venue&tribe_venue=12345&post_type=trive_venue`
 * Here is the interesting thing, both of those URLs load the same template file`
   plugins/the-events-calendar/src/views/v2/default-template.php`. However, within
   the page itself, the normal link is treated like a venue but the longer link 
   is treated as if it is showing an **event**, not a venue. In fact, at the top
   of the page I can see the output “This event has passed” which should not be 
   showing on a venue page, only an event page. I think this is why the error is
   triggered, because it’s loading all the page elements for an _event_ when it’s
   supposed to be a _venue_.
 * Here is what I found about how that longer link is output.
    1. When I go to a vendor page, it shows the current events, and a previous and 
       next button.
    2. If the Next button is disabled, just click the Previous button first, then on
       the page that opens, Next should be enabled.
    3. The link of the Next button will be the longer “bad” link style.
    4.  - If I simply click Next at this point (the bad link), the URL will actually
          rewrite itself to the standard permalink style and the page opens perfectly
          normally.
        - If I right-click the Next button and click to open in a new tab, or if I 
          copy the link and paste it in a new tab, it does NOT rewrite, and it opens
          the bad page template and triggers the error. The page thinks I’m loading
          an event instead of a vendor.
 * I have no idea why opening the link directly by copy/paste or new tab does NOT
   rewrite it, and simply clicking the link **does** rewrite it, but this is the
   issue!
 * I don’t know if the bug is in how the default template parses the page. Or if
   it is something broken in not rewritting the URL when used directly. I don’t 
   know if that longer link style shows up in other contexts as well.
 * I hope this is enough info to be able to duplicate the issue and find a solution.
   I have TEC 6.13.2.1 and TEC Pro 7.6.0.2. It is licensed but I’m just a dev helping
   them out so I can’t do a normal support ticket or log in to their account. Hopefully
   this message is enough cause I’m not going to report this all over again in another
   system.
 * Thanks!

Viewing 5 replies - 1 through 5 (of 5 total)

 *  Plugin Support [Darian](https://wordpress.org/support/users/d0153/)
 * (@d0153)
 * [11 months, 2 weeks ago](https://wordpress.org/support/topic/error-incorrect-datetime-value-select-sql_calc_found_rows/#post-18529870)
 * Hi [@guyinpv](https://wordpress.org/support/users/guyinpv/)
 * Thanks for your message and for sharing your findings. Unfortunately, we cannot
   provide support in this forum for [premium users](https://wordpress.org/support/guidelines).
 * For us to help you better, please open a [Support Ticket](https://theeventscalendar.com/support/#contact)
   on our Help Desk.
 * You’ll hear from one of my colleagues soon!
 *  Plugin Support [Darian](https://wordpress.org/support/users/d0153/)
 * (@d0153)
 * [11 months, 1 week ago](https://wordpress.org/support/topic/error-incorrect-datetime-value-select-sql_calc_found_rows/#post-18534485)
 * Hi there,
 * It appears that we haven’t heard back from you in a while, so I’ll assume that
   the matter has been resolved. If you need any more help, feel free to open a 
   [Support Ticket](https://theeventscalendar.com/support/#contact) on our Help 
   Desk, and we’ll be happy to assist you.
 *  Thread Starter [Guyinpv](https://wordpress.org/support/users/guyinpv/)
 * (@guyinpv)
 * [11 months, 1 week ago](https://wordpress.org/support/topic/error-incorrect-datetime-value-select-sql_calc_found_rows/#post-18534965)
 * NO, the issue is absolutely NOT RESOLVED. Good grief. How many more people have
   to keep reporting the same issue to you guys and you keep closing their threads
   as if it’s resolved when it’s NOT?
 * I already said, I’m NOT repeating all this in some other system somewhere. I 
   reported it here and that’s it. We are trying to give you information, we are
   putting in the time, the troubleshooting, and you keep ignoring everyone and 
   not fixing the problem.
 * Use this information and fix your product! Stop marking threads as solved and
   telling us to go fill in more reports somewhere else all over again. It’s not
   my job.
 * You know the product has a bug, so go fix it. Look at all the other threads of
   people reporting the same thing. It’s been years now.
 *  Plugin Support [Darian](https://wordpress.org/support/users/d0153/)
 * (@d0153)
 * [11 months, 1 week ago](https://wordpress.org/support/topic/error-incorrect-datetime-value-select-sql_calc_found_rows/#post-18537682)
 * Hi [@guyinpv](https://wordpress.org/support/users/guyinpv/)
 * I understand where you’re coming from, and I truly appreciate you reaching out.
   However, please note that this forum is strictly for support related to the **
   free version** of the plugin.
 * For assistance with premium features or issues, we kindly ask that you [contact us through our **Help Desk**](https://theeventscalendar.com/support/#contact),
   where our team is better equipped to support you directly.
 * For more details, please see: [](https://wordpress.org/support/guidelines/#do-not-post-about-commercial-products)
   [Do not post about commercial products](https://wordpress.org/support/guidelines/#do-not-post-about-commercial-products)
 *  Thread Starter [Guyinpv](https://wordpress.org/support/users/guyinpv/)
 * (@guyinpv)
 * [11 months, 1 week ago](https://wordpress.org/support/topic/error-incorrect-datetime-value-select-sql_calc_found_rows/#post-18540581)
 * I don’t need “assistance”, this isn’t a ME problem. I’ve reported an issue with
   the plugin as have many others, yet it’s still a problem and forum threads keep
   getting closed as if “solved” when they aren’t.
 * So now you know the problem with the plugin and can work on a fix. Or not. I 
   don’t care, it’s your plugin. Leave it broken if that’s how you want to work.
   I’m not going to go track down some other place to report the exact same flippin
   problem all over again!
 * Enter the issue into your own bug tracker, I don’t need to do it for you. I’m
   a dev, I’m not the client, I’m not the owner of the license, I don’t have their
   login, I can’t read their support tickets, I don’t have their license key or 
   purchase details. I’m not playing this game. You have the info on the problem,
   do with it whatever you like.

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Error: Incorrect DATETIME value …. SELECT SQL_CALC_FOUND_ROWS’ is closed
to new replies.

 * ![](https://ps.w.org/the-events-calendar/assets/icon-256x256.gif?rev=2516440)
 * [The Events Calendar](https://wordpress.org/plugins/the-events-calendar/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/the-events-calendar/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/the-events-calendar/)
 * [Active Topics](https://wordpress.org/support/plugin/the-events-calendar/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/the-events-calendar/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/the-events-calendar/reviews/)

 * 5 replies
 * 2 participants
 * Last reply from: [Guyinpv](https://wordpress.org/support/users/guyinpv/)
 * Last activity: [11 months, 1 week ago](https://wordpress.org/support/topic/error-incorrect-datetime-value-select-sql_calc_found_rows/#post-18540581)
 * Status: resolved