Title: DateTime::__construct(): Failed to parse time string (raw)
Last modified: January 25, 2022

---

# DateTime::__construct(): Failed to parse time string (raw)

 *  Resolved [Scott Trsar](https://wordpress.org/support/users/scotttrsar/)
 * (@scotttrsar)
 * [4 years, 4 months ago](https://wordpress.org/support/topic/datetime__construct-failed-to-parse-time-string-raw-3/)
 * In regards to the original topic posted by _[@jonathanstegall](https://wordpress.org/support/users/jonathanstegall/)_
   that was closed but never actually solved titled “[DateTime::__construct(): Failed to parse time string (raw)](https://wordpress.org/support/topic/datetime__construct-failed-to-parse-time-string-raw/)”
   from over a year ago…
 * TEC Support team, can we all try to look into some of these claims even if you
   can’t replicate some of these issues?
 * This is very annoying and cluttering up server logs. Just by going directly to
   where the error is being thrown that was given to you in the previous thread,
   it’s obviously a developer known issue and looks to actually be deliberate.
 * In version **5.12.4**
    In file **the-events-calendar/common/src/Tribe/Date_Utils.
   php** In function **build_date_object()** Around lines **1247 – 1288**
 * There is a try/catch that clearly states the knowledge of this problem
    `// PHP
   5.2 will not throw an exception but will generate an error.`
 * Is this really an acceptable solution? To force a PHP error so that you can catch
   it? Should I hold my breath for a fix here?
 *     ```
       try {
       	// PHP 5.2 will not throw an exception but will generate an error.
       	$utc = new DateTimeZone( 'UTC' );
       	$timezone_object = Tribe__Timezones::build_timezone_object( $timezone );
   
       	if ( self::is_timestamp( $datetime ) ) {
       		$timestamp_timezone = $timezone ? $timezone_object : $utc;
   
       		return new Date_I18n( '@' . $datetime, $timestamp_timezone );
       	}
   
       	set_error_handler( 'tribe_catch_and_throw' );
       	$date = new Date_I18n( $datetime, $timezone_object );
       	restore_error_handler();
       }
       ```
   
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fdatetime__construct-failed-to-parse-time-string-raw-3%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

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

 *  Thread Starter [Scott Trsar](https://wordpress.org/support/users/scotttrsar/)
 * (@scotttrsar)
 * [4 years, 4 months ago](https://wordpress.org/support/topic/datetime__construct-failed-to-parse-time-string-raw-3/#post-15289863)
 * And this looks like an acceptable solution. [https://wordpress.org/support/topic/datetime__construct-failed-to-parse-time-string-raw-2/](https://wordpress.org/support/topic/datetime__construct-failed-to-parse-time-string-raw-2/)
 * Thanks [@andrewalba](https://wordpress.org/support/users/andrewalba/). Hoping
   they can step up the priority on this.
 *  [Jaime](https://wordpress.org/support/users/jaimemarchwinski/)
 * (@jaimemarchwinski)
 * [4 years, 3 months ago](https://wordpress.org/support/topic/datetime__construct-failed-to-parse-time-string-raw-3/#post-15400705)
 * Hi [@scotttrsar](https://wordpress.org/support/users/scotttrsar/)
 * Glad to see that you have found a workaround for now. We will continue to try
   replicating this issue to see if we can come up with a different solution for
   you.
 * We appreciate your patience and understanding!
 * Thanks,
    Jaime
 *  Plugin Author [Gustavo Bordoni](https://wordpress.org/support/users/bordoni/)
 * (@bordoni)
 * [4 years, 3 months ago](https://wordpress.org/support/topic/datetime__construct-failed-to-parse-time-string-raw-3/#post-15421150)
 * Hi [@scotttrsar](https://wordpress.org/support/users/scotttrsar/),
 * The problem you are facing is on your Bug Tracker, and due to some of the Guidelines
   from WordPress.org forums we might not be able to report back to you here when
   we fix it as the topic might be closed before we get to fixing the problem.
 * Keep an eye on our [changelogs](https://wordpress.org/plugins/the-events-calendar/#developers)
   for the following tracking code:
 * [TEC-4254]
 * Once the fix is out we will make sure that code is on the changelog so that everyone
   involved can see that the solution was put in place.
 * Unfortunately I cannot promise any estimated time of arrival for the bugfix because
   our team has a lot of competing priorities.
 * If you still are facing this bug after the release with your fix was applied 
   to your website please don’t hesitate to open another thread and we will assist
   you as best as we can.
 * best regards,
    -  This reply was modified 4 years, 3 months ago by [Gustavo Bordoni](https://wordpress.org/support/users/bordoni/).
 *  [robelemental](https://wordpress.org/support/users/robelemental/)
 * (@robelemental)
 * [4 years, 1 month ago](https://wordpress.org/support/topic/datetime__construct-failed-to-parse-time-string-raw-3/#post-15600825)
 * Hi [@scotttrsar](https://wordpress.org/support/users/scotttrsar/)
    We Just wanted
   to let you know with our latest release of The Events Calendar 5.14.2, we resolved
   the issue with validating “raw” as a date. Be sure to review our [Release Notes](https://theeventscalendar.com/release-notes/the-events-calendar/the-events-calendar-5-14-2/)
   for more details and update your plugin at your earliest convenience. As always,
   we recommend testing updates on a staging site first, but it should all be smooth
   sailing.
 * If you still have issue with this bug after updating to the latest release, please
   don’t hesitate to open another thread and we will assist you as best as we can.
 * Thanks,
    Rob
 *  Thread Starter [Scott Trsar](https://wordpress.org/support/users/scotttrsar/)
 * (@scotttrsar)
 * [4 years, 1 month ago](https://wordpress.org/support/topic/datetime__construct-failed-to-parse-time-string-raw-3/#post-15612890)
 * Confirmed this seems to be resolved after this release.
 * Thank you!
 *  Thread Starter [Scott Trsar](https://wordpress.org/support/users/scotttrsar/)
 * (@scotttrsar)
 * [4 years ago](https://wordpress.org/support/topic/datetime__construct-failed-to-parse-time-string-raw-3/#post-15674533)
 * [@robelemental](https://wordpress.org/support/users/robelemental/)
    This is happening
   again now with the v5.15.0 update that was released 5/19/22… Opening this topic
   back up.
 *  Plugin Support [WilloftheD](https://wordpress.org/support/users/abzlevelup/)
 * (@abzlevelup)
 * [4 years ago](https://wordpress.org/support/topic/datetime__construct-failed-to-parse-time-string-raw-3/#post-15680266)
 * Hi [@scotttrsar](https://wordpress.org/support/users/scotttrsar/), that’s not
   good. Could you try clearing plugin or server side caching if you do have any?
   It might be intermittent.
 * As a workaround for now, could you revert to the previous version? I would like
   to replicate the issue here and see what’s up.
 * Looking forward to helping you with this one.
 * Best,
    Abz
 * ________________________
 * Internal Bug Ticket Reference:
    TEC-4254

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

The topic ‘DateTime::__construct(): Failed to parse time string (raw)’ 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/)

## Tags

 * [database](https://wordpress.org/support/topic-tag/database/)
 * [timezone](https://wordpress.org/support/topic-tag/timezone/)
 * [warning](https://wordpress.org/support/topic-tag/warning/)

 * 7 replies
 * 5 participants
 * Last reply from: [WilloftheD](https://wordpress.org/support/users/abzlevelup/)
 * Last activity: [4 years ago](https://wordpress.org/support/topic/datetime__construct-failed-to-parse-time-string-raw-3/#post-15680266)
 * Status: resolved