Forums

[Plugin: Events Calendar] Recognise my time zone (7 posts)

  1. kiwia
    Member
    Posted 3 years ago #

    How do i get the calendar to display the current day iin my timezone ie. UTC +12.

    My Blog is set as UTC+12 but calendar still displaying wrong day?

  2. iamjoe
    Member
    Posted 2 years ago #

    I was having the same problem and just fixed it.

    Open ec_calendar.class.php
    Do a search for

    if ("$month/$day/$year" == date('m/j/Y'))

    and replace it with

    if ( $day == gmdate('j', (time() + (get_option('gmt_offset') * 3600))) && $month == gmdate('m', time()+(get_option('gmt_offset') * 3600)) && $year == gmdate('Y', time()+(get_option('gmt_offset') * 3600)) )

    Several people I read were having the same issue so I tried to fix it myself and it seems to work.

  3. Jonas Grumby
    Member
    Posted 2 years ago #

    Try the Automatic Timezone plugin.

  4. iamjoe
    Member
    Posted 2 years ago #

    I did but it would work for this plugin.
    I'm not sure but I think this code

    date('m/j/Y')

    was taking from the server directly when I'm in complete different countries so the time was off. By changing that line of code, I made it include the gmt_offset which was set by WP and Automatic Timezone.

  5. admin_nfbi
    Member
    Posted 2 years ago #

    Hi
    I tried both the solutions but the pop-up in my calendar still shows the wrong day(a day before the actual). Could you please provide a solution?

  6. otakuoverlord
    Member
    Posted 2 years ago #

    This is a quick fix when you have time() or mktime() calls that are returning GMT. Doesn't fix the actual problem but if you don't feel like recoding the widget calendar it does the job nicely.

    Open up your ec_calendar.class.php file, then paste the following line of code somewhere after the <?php (basically before the comments start)

    date_default_timezone_set(‘America/Los_Angeles’);
    Replace 'America\Los_Angeles' with the correct time zone you want to use from this list: http://ch2.php.net/manual/en/timezones.php

    Sidenote: why does the Large Calendar get the localized time zone but not the widget? And why is the coding so different???

  7. chromodoris
    Member
    Posted 2 years ago #

    otakuoverlord - Tried the others with no joy but your solution absolutely did the trick for me! Thanks!

Topic Closed

This topic has been closed to new replies.

About this Topic