Incorrect time zone offset from GMT

  • I recently upgraded to version 1.2.3 on a Ubuntu 10.04 server and I have noticed all of the times 1 hour off.  I looked at the server settings page (admin.php) and it indicates the following:

    Server Timezone Selection: America/Chicago Your current GMT offset is -4 hours.

    The correct offset is -5 hours, not -4. 

    It doesn't matter what timezone I set the server to, I still get an offset of -4 hours and all of the times on the calendar are off.

    I have checked that the server has the correct timezone (date command returns a time with CDT as time zone), and I have also checked phpinfo() and it displays the correct time zone as America/Chicago.

    PHP Info display:

    date/time support enabled
    "Olson" Timezone Database Version 0.system
    Timezone Database internal
    Default timezone America/Chicago

    Directive Local Value Master Value
    date.default_latitude 31.7667 31.7667
    date.default_longitude 35.2333 35.2333
    date.sunrise_zenith 90.583333 90.583333
    date.sunset_zenith 90.583333 90.583333
    date.timezone America/Chicago America/Chicago

    Anyone else have this problem?   Any ideas?

  • Figured out the problem.

    I had both a SERVER_TIMEZONE and a TIMEZONE value in the database.  The TIMEZONE value was set to "America/New_York" and the SERVER_TIMEZONE value was set to "America/Chicago".  The settings page sets the SERVER_TIMEZONE value, but the load_global_settings() method in the functions.php file checks the TIMEZONE value first.  Therefore, if the TIMEZONE value is set, the SERVER_TIMEZONE is basically ignored.


  • 2010-08-20

    where are the SERVER_TIMEZONE and TIMEZONE values in the DB? The problem I am having is that I am not able to change these from the Systems settings and Preferences since they are not visible.

  • Those values are in the webcal_config table in the database.  I changed the values with phpmyadmin. 

    I think there is a bug in webcalendar where the settings page does not change the appropriate timezone parameter.

  • David

    I saw this too after upgrading from 1.2.1 to 1.2.3.  After the upgrade, events were all showing in Eastern time.  Events previously scheduled at 9am PT were now showing up as 12n ET.  I saw the same message about the current GMT offset always showing -4, even when I tried changing the timezone to Pacific/Honolulu.

    My system's timezone is America/Los_Angeles (Pacific Time) but the variable said America/New_York.  I logged into the database using the mysql command line program and changed it using the following command:

    mysql> update webcal_config set cal_value="America/Los_Angeles" where cal_setting="TIMEZONE";

    • sock cooker
      sock cooker

      I got this with a fresh install, not an upgrade. Fixed it by going into mysql as you suggest.

      Trouble is, this was a fresh install of 1.2.7. You upgraded from 1.2.1 to 1.2.3 about 2.5 years ago. Has this problem been fixed in interim versions and accidentally resurfaced or has it sat around unfixed for 30 months?

  • romegas

    I confirm, the value TIMEZONE from webcal_config always remains to "America/New_york", it has to be changed manually.

    In my case, the server is in Brussels, if I do not change the timezone, the offset that is calculated to decide wether or not to send a reminder is always wrong, the reminder is never sent, and the cal_time from webcal_entry is wrong too (6 hours offset). It works fine now, reminders and cal_time are corrects.

    Webcal 1.2.3
    Apache 2.2

  • romegas

    Note : I also had to set the date.timezone setting into the php.ini in order to match my time zone :

    date.timezone = Europe/Brussels

  • srmorton

    If you are using Webcalendar version 1.2.3 there is a small bug introduced with this release in the timezone area.

    You will need to edit your "includes/functions.php" script file and go down to line number 3815 and comment out this line as follows:

    //date_default_timezone_set ( $GLOBALS['SERVER_TIMEZONE'] );

    This should fix all timezone issue related to setting the timezone for your area.

    There are two other default time zone settings which come into play during installation which should only effect the defaults for logs and communication during installation. If you are running PHP version 4 they will effect you as they use a php 5.1 function to set the times zone. Post back if this is an issue.


  • DocWhit

    Hi !
    I'm new and I have instaled Webcalendar 1.2.3
    I get this when I go to my Webcalendar website see below

    Fatal error: Call to undefined function: date_default_timezone_set() in /home/whitdoc/public_html/calendar2/includes/functions.php on line 3815

    Dose any one know What I can do ?
    My web server Co. will not help me and I have been useing webcalendar For years.. It is when I have to Upgread the webcalendar is when I lose all my work "This time I Upgrade From 1.2.1 Upgrade to 1.2.3 "
    When I upgrade from my webcalendar wile I have the webcalendar 1.2.1 ver. already installed with all my work in it.
    It says Below
    Fantastco said to upgrade webcalendar..
    when I ugrade it. Upgrading…

    Initializing Parameters - Done.
    Generating MySQL Backup - Done.
    Generating Files Backup - Done.
    Copying New Files - Done.

    Upgrade completed

    Your installation ofWebCalendar was upgraded.
    You can view it here:

    Please save following information. You will need it in order to restore if something went wrong

    If you don't have SSH access, ask support to help you:
    - Remove the directory /home/whitdoc/public_html/calender
    - Untar /home/whitdoc/fantastico_backups/calender.backup.1289240597.tgz
    - Empty the database whitdoc_wcln1
    - Import the file /home/whitdoc/fantastico_backups/calender/backup.sql into the database whitdoc_wcln1
    - Move /home/whitdoc/fantastico_backups/calender to /home/whitdoc/public_html/calender
    Sorry I just dont understand how to do what it is saying………….. :>(

    So I Revove it and start over by installing the Webcalendar 1.2.3
    after going throgh the info: for my new webcalendar 1.2.3  "See Below"
    An instance of WebCalendar was installed on
    Full installation path: /home/whitdoc/public_html/thecal
    Public URL:
    Admin URL:
    Username: docwhit2
    Password: staff
    MySQL database: whitdoc_wcln1
    MySQL user: whitdoc_wcln1
    Time of installation: Wednesday, 17th November, 2010 @ 12:23:45 PM
    it comes out with "Below"
    Fatal error: Call to undefined function: date_default_timezone_set() in /home/whitdoc/public_html/calendar2/includes/functions.php on line 3815

    Now I lost all my work and I dont have a webcalendar to start over..
    It looks as it is asking fro a time zone..
    FRY My time zone is -6,  I Live is Dallas, Texas USA.

    Sorry for the long riting But I have to somehow let someone know what is going on completly.. Sorry :>(

    Dose any one know how I can get this webcalendar back working…  or how or tell me what I can do ?


  • srmorton


    Read my post number 9 above this will fix the issue. There was a small error introduced in version 1.2.3 from 1.2.1.

    Just comment out the line. Be sure to use something like MS Notepad to edit the file if you don't have an html editor.

    This should not have effected the database. The issue is that you are running PHP version less than 5.1 and the PHP function used is a PHP 5.1 function not a PHP 4 function, but the line is in error anyway so it needs to be commented out reguardless of PHP version.


  • DocWhit

    Thank you Steve..,
    I went to File manger in my Cpanel and went hilight public_html
    then thecal where my Webcandar is…
    Then  includes  and functions.php
    over all like this


    when I hilight functions.php and Click Edit it came to This
    """Please select the character encoding to open this file with   "" it was set at""  us-ascii      ""so I clicked yes""

    It started out with something like this Below

    /* Most of WebCalendar's functions.
    * @author Craig Knudsen <>
    * @copyright Craig Knudsen, <>,
    * @license GNU GPL
    * @version $Id: functions.php,v 1.520.2.45 2010/08/15 03:14:59 cknudsen Exp $
    * @package WebCalendar

    /* Functions start here. All non-function code should be above this.
    * Note to developers:
    *  Documentation is generated from the function comments below.
    *  When adding/updating functions, please follow these conventions.
    *  Your cooperation in this matter is appreciated. :-)
    *  If you want your documentation to link to the db documentation,
    *  just make sure you mention the db table name followed by "table"
    *  on the same line. Here's an example:
    *    Retrieve preferences from the webcal_user_pref table.

    /* Logs a debug message.
    * Generally, we try not to leave calls to this function in the code.
    * It is used for debugging only.
    * @param string $msg Text to be logged
    function do_debug ( $msg ) {
      // log to /tmp/webcal-debug.log
      // error_log ( date ( 'Y-m-d H:i:s' ) . "> $msg\n<br />",

    NOTE: I could not see any Numbers like 3815
    So I close without saving..  Sorry Im not sure what Im doing :>(
    NOTE: I do see that I have HTML Editor,  CODE Editor and Edit in this File Manger..
    Am I even Close?


  • srmorton

    HTML or CODE editor should work. Even though it is a php script is not html you should be able to edit the file. The word of caution I expressed it because some folks will use something like a word processor to edit code file. These editors will place hidden charactures at the end of lines or carrage return+line feeds at the end which the PHP interperter can not process.

    HTML and Code editors do not do this.

    The function you are looking for is

    function load_global_settings ()

    which is a little over half way down the file. There are approx. 6108 lines of code in this script.

    If you run into trouble PM me with your email address and I'll send you a zip file of this script to replace yours. Do not post your real email here.


  • Carsten Giesen
    Carsten Giesen


    I do the change in the function.php.
    My TImezone = Europe/Brussel
    But now I have still a wrong offset from +1 houre!!!

    How can I resolve this?




  • Anonymous

    I am also still having this issue.  All my dates are off by 6 hours in the emails.  They display correctly in the calendar but not in an ical. 


  • Anonymous

    The timezone it is showing is the same one that shows if I do a time().


  • Anonymous

    Dear Sir/Madam,

    I live in Hong Kong (GMT +8). I am using your WebCalendar for my department to help request special duty roster. I have corrected the timezone bug with reference to:

    by adding “//” to “date_default_timezone_set ( $GLOBALS );”

    This part is fine. But then I encountered the second time/date bug here:

    Figure 1
    admin admin Friday, September 16, 2011 02:15 HKT Wong TM: O, no N to follow Event created

    Figure 2
    Updated: Saturday, September 17, 2011 02:15 HKT

    Note that in the entry, the time stamp is correct “Saturday, September 17…..”, but the Activity Log is incorrect, saying the time is “Friday, September 16….”

    Please help!



  • Anonymous

    There is still a problem with the time.  I have upgraded to 1.2.5 through my hosting provider, I have commented out the line in 3816 in the upgraded version.  The offset has not changed, hooray, but it still shows up incorrectly in other programs, such as lightning and TB. I believe it is related to DST.

  • DSS

    We are having the same kind of problem here. We upgraded from 1.2.3 to 1.2.4 and to 1.2.5 but the problem persists.

    The problem can be reproduced as follows:

    1) Before entering DST, a user created an event. The event is recorded, say as "Time: 9:00am-10:00am BRT"

    2) After entering DST, webcal adjusts the time and displays at 9:00-10:00, that's OK and it is expected.

    3) But then the user tries to create a new event on the same day:

    3.1) if the new event is from 10:00-11:00, webcal says: Your suggested time of 10:00am-11:00am conflicts with the following existing calendar entries xxxxxx (9:00am-10:00am) on Thursday, November 15, 2012 - which is wrong

    3.2) if the new event is from 9:00-10:00, webcal saves is as if no conflict is detected and show 2 events superimposed - which is also wrong

    Besides that, when the event created before DST is shown on Lightning is shows up with wrong times.

    Digging further we can see that events are being shown (recorded?) with DST info. Let's take a look at 2 events
    - this one was created before entering DST:
    Description: xxxxxxxxx
    Date: Thursday, October 18, 2012
    Repeat Type: Weekly;Days=TH;Until=12/31/2012 2:00am
    Time: 9:00am-10:00am BRT

    - this one was created today and appears superimposed
    Description: test
    Date: Thursday, November 15, 2012
    Time: 9:00am-10:00am BRST

    Those are actually not the same time, but it seems that webcal adjusts events created before DST but do not adjust correctly events created during DST.

    It seems that webcal correctly adjusts the time when it displays the events on the web interface, but the time is incorrectly computed
    - when it checks for conflicts
    - when the event is exported through icalclient.php

    It should be easy to fix, please take a look at that.

    Thanks for you excellent work.

  • DSS

    I think I should add that (regarding post #19 above):
    - when we are on standard time, the server is configured as BRT:
    - when we are on DST, it is configured as BRST
    Maybe that is confusing webcal, but that's just my 2 cents.

    Today's output:
    $ date
    Fri Nov 16 20:59:23 BRST 2012

  • Neik

    WTF? I just upgraded to 1.2.7 from an earlier version and I had to apply the patch from srmorton above. Why isn't this fixed three years later?

  • sarma81

    Could someone please help me fix this bug? I tried smorton's suggestion without success. Here is my includes/functions.php script file:

    if ( empty ( $GLOBALS['TIMEZONE'] ) )

    set_env ( 'TZ', $GLOBALS['TIMEZONE'] );
    if ( function_exists ( "date_default_timezone_set" ) )
    date_default_timezone_set ( $GLOBALS['TIMEZONE'] );

    What exactly am I supposed to comment out?

    • Tom von Alten
      Tom von Alten

      Those last two lines (which are one statement):
      if (function_exists ... ;

      I see that in the years-ago posts, it was said to comment out the ONE line of the file, starting with date_default_timezone_set; but that surely would not work, since the line of CODE is

      if ( condition ) date_default_timezone_set ( arg );

      and you'd be commenting out just part of the line, and leaving the parser looking for a semicolon.

      Last edit: Tom von Alten 2013-09-10