1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Fixed [SMF] Import - Timezone for imported users is incorrect

Discussion in 'Resolved Bug Reports' started by Omar Bazavilvazo, Dec 22, 2014.

  1. Hi,

    My php.ini timezone is:
    date.timezone = America/Mexico_City

    I already checked timezone is correct on php.ini and the visitor's timezone is also set to Mexico (UTC-6)

    In my old forum, for example I have this user with timezone difference = 15 (japan)

    However, after imported, this user has a timezone equal to (UTC) Dublin, Edinburgh, Lisbon, London

    Any idea if this has been already fixed? (Or maybe I did something wrong)

  2. Mike

    Mike XenForo Developer Staff Member

    I suspect the time zone isn't imported. And I can understand why if Japan is stored as 15, as that sounds like it's relative to an unknown server time (we can't rely on server settings to be maintained/accurate).

    As such, it would take the default time zone setting in XF.
  3. Hi!

    In SMF the timezone is relative to the forum default timezone.

    For example, this:
    SELECT variable, value FROM `smf_settings` where variable like '%zone%'
    gives one record with:

    variable = default_timezone
    value = Etc/GMT+6

    So in every member there is a field called time_offset. Here the offset is added or substracted for every member, so the times are displayed correctly:

    SELECT id_member, time_offset FROM `smf_members` where id_member=1 or id_member=2
    id_member time_offset
    1 0
    2 15

    And... that is how a correct timezone is displayed for everybody
  4. Chris D

    Chris D XenForo Developer Staff Member

    We have adjusted this for the next version of the importer. This still won't be perfect, but should be more accurate in most cases.
  5. Great!

    Any ETA for a new version to be released?
  6. Sorry, seems i gave incorrect information.

    I just checked this:

    The timezone can be changed/checked from:
    Admin -> Features and Options

    server timezone I don't see where is used... I had africa and just changed it to mexico and i see the same offsets as guest.

    Now, the correct timezone for members is:

    // The current time with offset.
    function forum_time($use_user_offset true$timestamp null)

        if (
    $timestamp === null)
    $timestamp time();
        elseif (
    $timestamp == 0)

    $timestamp + ($modSettings['time_offset'] + ($use_user_offset $user_info['time_offset'] : 0)) * 3600;
    so, the time displayed per user is server time + forum offset + user offset

    In my case, forum offset is equal to zero, since the time of my server is the same as my timezone (since I own the server)
    SELECT * FROM `smf_settings` WHERE variable like '%offset%' 
    variable -> time_offset
    value -> 0

    and, user offset is equal to what i said before:
    SELECT id_member, time_offset FROM `smf_members` where id_member=1 or id_member=2
    time_offset for id=1 -> 0 (me in mexico)
    time_offset for id=2 -> 15 (japan)
  7. Chris D

    Chris D XenForo Developer Staff Member

    That is essentially how we are importing it after the most recent changes, I came to the same conclusion in my testing, so no worries about the original information not being totally correct :) Thanks for the update, though.
    Liam W likes this.

Share This Page