Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • masuda Friend
    #147358

    Hi all,

    Is it possible to add “+9” to ”GMT” and disply the update time, like “Last update 11:22:15 PM GMT+9”? If so, please tell/show me how.

    Thank you.

     

    Saguaros Moderator
    #328506

    Hello guy!

    Here is the solution:

    Please open the file: templatesja_teline_iiilibja.template.helper.php and try to find code in the getLastUpdate() function :
    [PHP] return gmdate(“h:i:s A”, $sec+$tz).’ GMT’ [/PHP]
    and replace:
    [PHP] return gmdate(“h:i:s A”, $sec+$tz).’ GMT ‘ . ($tz < 0 ? $tz: ( $tz >0 ?”+”.$tz:””) );[/PHP]

    and then you login with a account, you ‘ll see that. you can test this by change the timezone of user in the user manager,

    Good luck

    masuda Friend
    #328544

    Hi tienhc!

    Thank you for your quick reply!

    I replaced the code as follows:
    [PHP]function getLastUpdate(){
    $db = &JFactory::getDBO();
    $query = ‘SELECT created FROM #__content a ORDER BY created DESC LIMIT 1’;
    $db->setQuery($query);
    $data = $db->loadObject();
    if( $data->created ){ //return gmdate( ‘h:i:s A’, strtotime($data->created) ) .’ GMT ‘;
    $date =& JFactory::getDate(strtotime($data->created));
    $user =& JFactory::getUser();
    $tz = $user->getParam(‘timezone’);
    $sec =$date->toUNIX(); //set the date time to second
    return gmdate(“h:i:s A”, $sec+$tz).’ GMT ‘ . ($tz < 0 ? $tz: ( $tz >0 ?”+”.$tz:””) );
    }
    return ;
    }[/PHP]

    And I loggedin and tested it, but nothing happned… Can you tell why?
    (I forgot to tell you this, but I’m using ja_seleni, so I opened the file: templatesja_selenilibsja.template.helper.php)

    Thank you
    Saguaros Moderator
    #328546

    AH yes, The account is not set the timezone, now you access the user manager => choose this account, You looking for the “Timezone” paramter, you change the timezone in there. After you changed, you logout this acccount and try to login again.

    masuda Friend
    #328627

    Still, nothing happned… :confused:

    Not only that, I noticed that “Last update” didn’t work right.
    I set the timezone (UTC +9:00), logged out and in, and made a new article.
    “Created” showed 11:12:00AM, which was the correct time. I saved it, checked the site, and foud out that “Last update” said “05:12:00PM.” You see, Last update shows “UTC+3:00” timezone time.
    Even I replaced the original php code, it’s stil the same.

    I checked “Site”>”Server”>”Time Zone,” as well. It was set the timezone (UTC +9:00).

    What’s going on here? Do you have any ideas?

    Daniel Raymo Friend
    #330082

    I’ve had the same problem… and there seems to be some problems in the original code

    [PHP]function getLastUpdate(){
    $db = &JFactory::getDBO();
    $query = ‘SELECT created FROM #__content a ORDER BY created DESC LIMIT 1’;
    $db->setQuery($query);
    $data = $db->loadObject();
    if( $data->created ){ //return gmdate( ‘h:i:s A’, strtotime($data->created) ) .’ GMT ‘;
    $date =& JFactory::getDate(strtotime($data->created));
    $user =& JFactory::getUser();
    $tz = $user->getParam(‘timezone’);
    $sec =$date->toUNIX(); //set the date time to second
    return gmdate(“h:i:s A”, $sec+$tz).’ GMT ‘ . ($tz < 0 ? $tz: ( $tz >0 ?”+”.$tz:””) );
    }
    return ;
    } [/PHP]

    $tz = $user->getParam(‘timezone’); doesn’t return anything, so the function doesn’t know what timezone you’re in.

    I don’t know what getParam(‘timezone’) is supposed to return…but unless it’s in seconds it wouldn’t work anyhow

    and — return gmdate(“h:i:s A”, $sec+$tz) — should be — return date(“h:i:s A”, $sec+$tz) otherwise it’s just converting it back to GMT with gmdate()

    It is actually checking for the last time a documented was created not modified.

    Saguaros Moderator
    #330703

    Hello guy!

    With above codes, the updated date ‘ll display follow up the user’s timezone when user logined. I tested those codes in my site. They are work when you changed the user’s time. I notice that you change the user’s time zone, you must to logout and re-login system, because the problem is from section store user’s information, it’s not update if you do not logout and login .

    Please kindly test this issue again

    masuda Friend
    #330711

    Hi! Thank you for the reply!

    Hmmm. So if I replace “return gmdate(“h:i:s A”, $sec+$tz)” with “return date(“h:i:s A”, $sec+$tz),”
    this problem would be solved?

    > It is actually checking for the last time a documented was created not modified.

    Yeah, I noticed that….

    Daniel Raymo Friend
    #330757

    Hi Masuda,

    No…that didn’t work for me. It looks like the script is trying to set the timezone ($tz) from a cookie (which I think would be the actual users timezone), but at least on my PC and probably yours $tz is not being set… I had the function print out $tz and it was blank. What I did as a work around:

    I replaced:
    $tz = $user->getParam(‘timezone’); with $tz = 60 * 60 * -5;
    (-5 being my timezone)

    And changed the last line to (I added the date in the format “M d”):
    return date(“M d h:i:s A EST”, $sec + $tz);

    Although not elegant…it worked for what I needed.

Viewing 9 posts - 1 through 9 (of 9 total)

This topic contains 9 replies, has 3 voices, and was last updated by  Daniel Raymo 14 years, 10 months ago.

We moved to new unified forum. Please post all new support queries in our New Forum