Date function not working properly. Is this the Events Calendar?

Home Forums Calendar Products Events Calendar PRO Date function not working properly. Is this the Events Calendar?

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #1112499
    fifteen15studios
    Participant

    Hi Events Calendar,

    I have an odd situation and I’m not sure if this is something with which you can help.

    When I do a date function in PHP, I get a time result which is 4 hours ahead of our usual EST timezone. I figured this could be because of a bunch of reasons. One could be that the server’s time is off. However, when I do it on a non-Wordpress page but still on the same site, it reports the correct time. Another problem could be that the UTC settings in the WordPress dashboard were off. I tried setting them to something different, but it still reported the incorrect time.

    Is The Events Calendar doing something to my site which changes the time the date function displays to be four hours ahead? It should report 11:02pm now, but it displays 3:02am the next day. Is there some setting on The Events Calendar that I’m missing? This isn’t happening with my other WordPress sites.

    Any advice you can give would be much appreciated. Thanks!

    Brendan

    #1112510
    Cliff
    Member

    Hi Brendan.

    I believe you are comparing your server’s time/timezone and your WordPress installation’s time/timezone.

    If you take a look at your System Information report, I believe it outputs both of those pieces of information (and lots more).

    I hope this helps you toward your goal, whatever that may be.

    #1113399
    fifteen15studios
    Participant

    Hmm… I’m not sure if the time is detailed in this, but I’ll post it. I think I could try a phpinfo, but that still doesn’t tell me why it’s happening.

    #1113401
    fifteen15studios
    Participant

    This reply is private.

    #1113470
    Cliff
    Member

    Thanks for that information.

    From this (near the bottom of y0ur sysinfo report):

    WordPress timezone
    –
    server timezone
    UTC

    I can see that your WordPress General Settings timezone has not been set yet. You can visit wp-admin > Settings > General > “Timezone” setting — set it to something — and then see if your script has any change.

    If that does not resolve your issue, please follow our Testing for Conflicts Guide and see if that helps narrow down the cause of this.

    If it doesn’t, would you mind enabling WP_DEBUG and sharing any messages you see while navigating your site’s home page, events page, single-event pages, and any other of your site’s pages relevant to this ticket?

    After all that, please let us know if you think you’ve found a bug.

    Thanks.

    #1114398
    fifteen15studios
    Participant

    This reply is private.

    #1114400
    fifteen15studios
    Participant

    I just sent some of the notifications I saw after turning on debug. They’re nothing that really stand out. A bunch of notices, really. I just sent a few. I didn’t see any errors.

    I tried a different theme and the time was still off. I tried turning off my plugins and my time was still off. I checked to make sure my time was set in Geenral Settings, and it was, at UTC -4.

    I have a theory. I think WordPress forces UTC on the date function in PHP, whereas a normal page would just use the server’s time. Since WordPress forces UTC, it requires us to set the time in Settings. I set mine, but it doesn’t seem to be working. If it’s not reported in the details I sent you, and it usually is, its probably because it’d not going through for some reason. Any idea why?

    Thanks!
    Brendan

    #1115136
    Cliff
    Member

    When I do a date function in PHP…

    Yes, I believe you’re correct that WordPress tries to force PHP to use UTC regardless of its General Settings (so its own date functions work consistently), so that would seem to explain what you’re seeing.

    Please let me know if you need anything else.

    #1120710
    Support Droid
    Keymaster

    This topic has not been active for quite some time and will now be closed.

    If you still need assistance please simply open a new topic (linking to this one if necessary)
    and one of the team will be only too happy to help.

Viewing 9 posts - 1 through 9 (of 9 total)
  • The topic ‘Date function not working properly. Is this the Events Calendar?’ is closed to new replies.