-
AuthorPosts
-
April 23, 2011 at 6:31 am #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 Friendicbl
- Join date:
- December 2010
- Posts:
- 242
- Downloads:
- 0
- Uploads:
- 28
- Thanks:
- 86
- Thanked:
- 7 times in 1 posts
April 23, 2011 at 10:36 am #387737I also looking for same thing but so far no solution yet. Brisbane.
comraseliteunit Friendcomraseliteunit
- Join date:
- September 2010
- Posts:
- 40
- Downloads:
- 1
- Uploads:
- 5
- Thanks:
- 10
- Thanked:
- 3 times in 1 posts
April 23, 2011 at 5:51 pm #387755i 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 ModeratorPhill
- Join date:
- February 2014
- Posts:
- 7013
- Downloads:
- 40
- Uploads:
- 77
- Thanks:
- 917
- Thanked:
- 2206 times in 1818 posts
April 23, 2011 at 7:24 pm #387774Try 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
icbl Friendicbl
- Join date:
- December 2010
- Posts:
- 242
- Downloads:
- 0
- Uploads:
- 28
- Thanks:
- 86
- Thanked:
- 7 times in 1 posts
April 23, 2011 at 8:23 pm #387784Hi 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 ModeratorPhill
- Join date:
- February 2014
- Posts:
- 7013
- Downloads:
- 40
- Uploads:
- 77
- Thanks:
- 917
- Thanked:
- 2206 times in 1818 posts
April 23, 2011 at 9:34 pm #387789Hmm, 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 Friendicbl
- Join date:
- December 2010
- Posts:
- 242
- Downloads:
- 0
- Uploads:
- 28
- Thanks:
- 86
- Thanked:
- 7 times in 1 posts
April 23, 2011 at 10:00 pm #387794Thanks Phil, I’ll wait for it.
Regards
April 28, 2011 at 10:58 pm #388889Hello,
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 ModeratorPhill
- Join date:
- February 2014
- Posts:
- 7013
- Downloads:
- 40
- Uploads:
- 77
- Thanks:
- 917
- Thanked:
- 2206 times in 1818 posts
April 28, 2011 at 11:15 pm #388891After 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 ;
} -
AuthorPosts
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