Support

Home Forums Event Espresso Premium Completely wrong date and time is being displayed

Completely wrong date and time is being displayed

Posted: October 8, 2015 at 9:33 am

Viewing 11 reply threads


Michael Kimble

October 8, 2015 at 9:33 am

I am running EE4 Version 4.8.14.p

I have created an event with a specified start and end time, but when the event is published, something completely different appears.

Take a look at the event link
http://www.breakpointchurch.com/events/womens-christmas-social/

According to the displayed page, the event starts on December 5th at 9:00am and ends on December 6th at 2:00am

When I created the event I specified that it should start on December 5th from 11:00am to 3:00pm

Any suggestions?


Michael Kimble

October 8, 2015 at 9:51 am

And update on this issue. The system time in my WordPress configuration was wrong, so that issue is not fixed. But events are being displayed 5 hours earlier then they are supposed to.

The event is now being displayed from 6:00am to 10:00am, which is 5 hours off


Tony

  • Support Staff

October 8, 2015 at 9:54 am

Normally this happens when another plugin is using date_default_timezone_set() which is discouraged within WordPress, mentioned here:

https://vip.wordpress.com/documentation/vip-development-tips-tricks/use-current_time-not-date_default_timezone_set/

and

https://weston.ruter.net/2013/04/02/do-not-change-the-default-timezone-from-utc-in-wordpress/

Do you have any other plugins that deal with anything date or time based? This could be a calendar, post scheduler etc.


Michael Kimble

October 8, 2015 at 10:09 am

Tony, I have no idea if I have a plugin that could be screwing this up. ๐Ÿ™

Let me ask this question before I start to troubleshoot what is going on.

If I go into Settings -> General settings, What should the timezone value be set to? Should I set it to New York, or use UTC -4 (which I believe is the current time zone value).


Lorenzo Orlando Caum

  • Support Staff

October 8, 2015 at 10:43 am

Hi Michael,

You should use a city/region in your time zone rather than a UTC setting.

Are you using any bookings / appointments / other calendar plugins on your site?

If so, they may be interfering as Tony shared:

https://eventespresso.com/topic/completely-wrong-date-and-time-is-being-displayed/#post-176331


Lorenzo


Michael Kimble

October 8, 2015 at 11:38 am

OK….I have changed the timezone setting to New York, and the time is still displayed incorrectly.

I went through the list of plugins, and I don’t see any plugins that have anything to do with bookings, appointments, or other calendars.

Any suggestions?


Lorenzo Orlando Caum

  • Support Staff

October 8, 2015 at 11:53 am

Okay, have you tried temporarily deactivating all plugins and reactivating only Event Espresso 4?

Does the time still appear to be incorrect?

What happens if you create a new event and publish it? Is that time still incorrect as compared to what was selected and saved in the event editor?


Lorenzo


Michael Kimble

October 8, 2015 at 12:06 pm

I disabled every plugin (except for ee4), created new events, and the time displayed is still wrong.

My theme has a calendar function, but obviously I am not using it. Without disabling my theme, how can I tell if the theme is causing the issue?


Josh

  • Support Staff

October 8, 2015 at 3:17 pm

Hi Michael,

One way is to look in the theme for code, or ask the theme developer if they have code, like this in the theme’s functions:

date_default_timezone_set(get_option('timezone_string'));

Another way is to use the WordPress Customizer to preview your event page in another theme. You can preview your event page by going to one of your event pages like the one you linked to. You’ll need to be logged in, and you’ll click the Customize button on the bar. Then next to where it says “Active Theme”, you click Change, then you scroll down and click Live Preview on one of the other themes.

If the times are correct when you’re previewing another theme, that’s a good indication that your theme is causing the issue.


Michael Kimble

October 8, 2015 at 4:57 pm

I think I found something….

This snippet of code is in the header.php file.

$offset = get_option(‘timezone_string’);
if($offset==”) { $offset = “Australia/Melbourne”; }
date_default_timezone_set($offset);

Is this code the culprit?


Michael Kimble

October 8, 2015 at 5:01 pm

Just to follow up…I did what you suggested, and viewed the page with another theme. The page looks just fine. ๐Ÿ™‚

I will reach out to the theme developer for support.

Thanks for your help


Tony

  • Support Staff

October 9, 2015 at 4:51 am

Hi Michael,

Yes that code is likely the culprit.

date_default_timezone_set($offset); should not be used within WordPress.

You may be able to comment out that line and everything will work as expected although it depends on how heavily the theme is relying on that code so you are best contacting the developer to see what they advise.

Please do let us know how you get on.

Viewing 11 reply threads

The support post ‘Completely wrong date and time is being displayed’ 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.

Event Espresso