Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • ruddin3195 Developer
    #163130

    Hi,

    I am using JA SOCIAL template. I want to change the top left today’s DATE and LAST UPDATE time according to my location Australia/Melbourne. There are few posts regarding the day and last update but nothing seems related to the time zone I am looking for. I have changed the Time Zone in the Global Configuration but still not getting the correct time and date.

    Any help would be highly appreciated.

    Cheers

    icbl Friend
    #387737

    I also looking for same thing but so far no solution yet. Brisbane.

    comraseliteunit Friend
    #387755

    i believe that time and date, it is using the one which has been set up in the server.. meaning your hosting server.. so whatever time or date, then it is following the one from the hosting server.. not from our joomla setup..

    Phill Moderator
    #387774

    Try opening templates>ja_social>blocks>topbar.php and changing

    <p class="ja-updatetime"><span><?php echo JText::_('Last update')?></span><em><?php echo T3Common::getLastUpdate(); ?></em></p>

    to

    <p class="ja-updatetime"><span><?php echo JText::_('Last update')?></span><em>

    <?php
    $gmt = T3Common::getLastUpdate();
    $gmt = str_replace(" GMT", "", $gmt);
    date_default_timezone_set("GMT");
    $timestamp = strtotime($gmt);
    date_default_timezone_set("America/New_York"); // time is in EST
    $est = date("h:i:s A", $timestamp);
    echo $est." EST";
    ?>

    </em></p>

    But change the bits in red as required depending on your locale. A full list can be seen here

    http://www.php.net/manual/en/timezones.php

    icbl Friend
    #387784

    Hi Phil,
    Ive updated the code according to Australia/Queensland which is AEST as below but time not changing after some updates. Always showing 10:00

    <?php
    /*
    # ------------------------------------------------------------------------
    # JA Social Template
    # ------------------------------------------------------------------------
    # Copyright (C) 2004-2010 JoomlArt.com. All Rights Reserved.
    # @license - PHP files are GNU/GPL V2. CSS / JS are Copyrighted Commercial,
    # bound by Proprietary License of JoomlArt. For details on licensing,
    # Please Read Terms of Use at http://www.joomlart.com/terms_of_use.html.
    # Author: JoomlArt.com
    # Websites: http://www.joomlart.com - http://www.joomlancers.com
    # Redistribution, Modification or Re-licensing of this file in part of full,
    # is bound by the License applied.
    # ------------------------------------------------------------------------
    */
    ?>
    <?php $this->genBlockBegin ($block) ?>

    <p class="ja-day">
    <?php
    echo "<span class="day">".date ('l')."</span>";
    echo "<span class="date">, ".date ('M')." ".date ('d').date ('S')."</span>";
    ?>
    </p>
    <p class="ja-updatetime"><span><?php echo JText::_('Last update')?></span><em>

    <?php
    $gmt = T3Common::getLastUpdate();
    $gmt = str_replace(" GMT", "", $gmt);
    date_default_timezone_set("GMT");
    $timestamp = strtotime($gmt);
    date_default_timezone_set("Australia/Queensland"); // time is in AEST
    $est = date("h:i:s A", $timestamp);
    echo $est." AEST";
    ?>

    </em></p>

    <?php if($this->countModules('ja-login')) : ?>
    <div id="ja-headtools" class="ja-headtool">
    <ul>
    <jdoc:include type="modules" name="ja-login" />
    </ul>
    </div>
    <?php endif; ?>

    <?php $this->genBlockEnd ($block) ?>

    Phill Moderator
    #387789

    Hmm, the above code only seems to work with the later T3 framework. I’ll have to let the devs take a look as I am not sure where the time is generated.

    icbl Friend
    #387794

    Thanks Phil, I’ll wait for it.

    Regards

    ak1design Friend
    #388889

    Hello,

    could you please let us know how to hide the complete dates and last updated untill there is a solution to it.

    Manay thanks

    Phill Moderator
    #388891

    After you have edited the above code please try editing plugins>system>jate>core>common.php

    find

    function getLastUpdate($fieldname=null){
    if (!$fieldname) $fieldname = 'created';
    $db = &JFactory::getDBO();
    $query = "SELECT `$fieldname` FROM #__content a ORDER BY `$fieldname` DESC LIMIT 1";
    $db->setQuery($query);
    $data = $db->loadObject();
    if( $data->$fieldname ){ //return gmdate( 'h:i:s A', strtotime($data->created) ) .' GMT ';
    $date =& JFactory::getDate(strtotime($data->$fieldname));
    //get timezone configured in Global setting
    $app = & JFactory::getApplication();
    $tz = $app->getCfg('offset')*60*60;
    $sec =$date->toUNIX(); //set the date time to second
    //return by the format defined in language
    return strftime (JText::_('T3_DATE_FORMAT_LASTUPDATE'), $sec+$tz);
    }
    return ;
    }

    and replace with

    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';
    }
    return ;
    }

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

This topic contains 9 replies, has 5 voices, and was last updated by  Phill 13 years, 7 months ago.

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