I’m using EE4 (latest update), and have set up two events for Jan 15, 2015. I added the following code to part of the sidebar of the event registration post:
$_event_date_obj = espresso_event_date_obj();
$_event_date = strtotime($_event_date_obj->start_date_and_time( 'D M jS', 'g:i a' ));
$_course_datetime = date("M", $_event_date) . " " . date("j", $_event_date) . ", " . date("Y", $_event_date);
However, instead of shown Jan 15, 2015, the date shown is Jan 16, 2014 (that is, 364 days of difference). I checked the event start date on both the admin area as well as the database itself, both have the correct value.
How can I fix this? Is this a bug?
PS: I saw in the release notes for the latest version that there was a bug with the start date when using UTC time. In my case, WordPress is configured to use UTC, but not sure if this is related, as it was not really fixed after the update.
It looks like the start_date_and_time() method is getting a date format passed in that will not disambiguate. The default date format is ‘F j, Y’, so if you don’t pass in a date format parameter it will use the default instead.
The support post ‘espresso_event_date_obj() returning wrong event start date’ is closed to new replies.
Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.
Support forum for Event Espresso 3 and Event Espresso 4.