-
AuthorPosts
-
micrantha Friend
micrantha
- Join date:
- May 2007
- Posts:
- 465
- Downloads:
- 0
- Uploads:
- 6
- Thanks:
- 6
- Thanked:
- 158 times in 148 posts
April 27, 2010 at 2:08 pm #341786April 27, 2010 at 3:58 pm #341810Thanks, but I don´t see the code to be replaced that mentioned:
Code:
return gmdate(“h:i:s A”, $sec+$tz).’ GMT’;withI´ve been working on file: layouts/blocks/header.php
Also,pls notice that I have to express time as local, Mexico City Time:
Standard time zone: UTC/GMT -6 hours
Daylight saving time: +1 hour
Current time zone offset: UTC/GMT -5 hours
Time zone abbreviation: CDT – Central Daylight TimeSo, still I can´t set proper time on headers.
micrantha Friendmicrantha
- Join date:
- May 2007
- Posts:
- 465
- Downloads:
- 0
- Uploads:
- 6
- Thanks:
- 6
- Thanked:
- 158 times in 148 posts
April 27, 2010 at 6:27 pm #341824Hello,
Look in same thread, 2 posts earlier…
Code for last-update is in file ja_teline_iii/libs/ja.template.helper.php
I don’t know how to configure “setlocale” for time zone of Mexico City.
Maybe Gray knows how to find out.Regards,
MicranthaSaguaros ModeratorSaguaros
- Join date:
- September 2014
- Posts:
- 31405
- Downloads:
- 237
- Uploads:
- 471
- Thanks:
- 845
- Thanked:
- 5346 times in 4964 posts
April 28, 2010 at 8:00 am #341872Dear paellas!
Here is the solution for you :
you replace:
[PHP]return gmdate(“h:i:s A”, $sec+$tz).’ GMT’;[/PHP]
by:[PHP]
$tz=-5;
return date(“h:i:s A”, $sec+ $tz*3600 ).’ GMT’;[/PHP]Good luck
1 user says Thank You to Saguaros for this useful post
April 28, 2010 at 8:08 am #341874I think I have to take a step back on the solution proposed by micrantha: it seems that it does not support UTF-8.
The word “Miércoles” does not show due to the accent … so I have to seek another soluton.
April 28, 2010 at 9:47 am #341889<em>@tienhc 176433 wrote:</em><blockquote>Dear paellas!
Here is the solution for you :
you replace:
[PHP]return gmdate(“h:i:s A”, $sec+$tz).’ GMT’;[/PHP]
by:[PHP]
$tz=-5;
return date(“h:i:s A”, $sec+ $tz*3600 ).’ GMT’;[/PHP]Good luck</blockquote>
Just to confirm …At fiel: /templates/ja_teline_iii/layouts/blocks/header.php
I currently have:
<p class=”ja-updatetime”><span><?php echo JText::_(‘Actualización’)?></span><em><?php echo $this->getLastUpdate(); ?></em></p>
You want me to replace
PHP de Code:
———————-
return gmdate(“h:i:s A”, $sec+$tz).’ GMT’;by:
PHP Code:
——————$tz=-5;
return date(“h:i:s A”, $sec+ $tz*3600 ).’ GMT’;Great … but I don´t see code to be replaced at this file.
So, could you specify which file should I mofify?
micrantha Friendmicrantha
- Join date:
- May 2007
- Posts:
- 465
- Downloads:
- 0
- Uploads:
- 6
- Thanks:
- 6
- Thanked:
- 158 times in 148 posts
April 28, 2010 at 4:09 pm #341935🙂
Original funcion getLastUpdate() PHP 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’;
}
return ;
[/PHP]SOLUTION:
============
* Thanks to MICRANTHA for function getLastUpdate() I found file ja_teline_iii/libs/ja.template.helper.php
* I changed: GMT for CDT on the code
* And thanks to TIENHC changed the following InstructionReplaced PHP Code:
———————-
[PHP]
return gmdate(“h:i:s A”, $sec+$tz).’ GMT’;
[/PHP]With PHP Code:
——————
[PHP]
$tz=-5;
return date(“h:i:s A”, $sec+ $tz*3600 ).’ GMT’;
[/PHP]So End Result:
———————
[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) ) .’ CDT ‘;
$date =& JFactory::getDate(strtotime($data->created));
$user =& JFactory::getUser();
$tz = $user->getParam(‘timezone’);
$sec =$date->toUNIX(); //set the date time to second
$tz=-5;
return date(“h:i:s A”, $sec+ $tz*3600 ).’ CDT’;
}
return ;[/PHP]
“Last Update” Problem Solved !
———————————
=================================FYI => MEXICO CITY TIME:
————————————–
Standard time zone: UTC/GMT -6 hours
Daylight saving time: +1 hour
Current time zone offset: UTC/GMT -5 hours
Time zone abbreviation: CDT – Central Daylight TimeCurrent time is DST
Daylight Saving Time DST started on domingo, 4 de abril de 2010, 2:00 local standard time
DST ends on domingo, 31 de octubre de 2010, 2:00 local daylight timeMore info at: http://www.timeanddate.com/worldclock/city.html?n=155
May 17, 2010 at 12:06 am #343764I finally came out with a solution – even for Spanish Language accent in certain days of the week … so Thanks to everyone …
SOLUTION
————–
First, TELINE-III is an English language template so for translation got file:
“en-GB.tpl_ja_teline_iii.ini”Located at “/language/en-GB”
Translated it, not changing labels, and saved it with name “es-ES.tpl_ja_teline_iii.ini” on Format UTF-8 and uploaded to: “/language/es-ES”
Date & Time still shows up in English at upper left hand side … so for file header.php,
I replaced:
——————-
<p class=”ja-day”>
<?php
echo “<span class=”day”>”.date (‘l’).”</span>”;
echo “<span class=”date”>, “.date (‘M’).” “.date (‘d’).date (‘S’).”</span>”;
?>
</p>For lines:
———–
<p class=”ja-day”>
<?php
setlocale(LC_TIME, “es_ES”);
echo “<span class=”day”>”.JText::_(date (‘l’)).”</span>”;
echo strftime(“%d de %B %Y n”);
?>
</p>So output is now:
———————-
“Day-of-the-Week” “Day” de “Year”Notice that I had the problem that Day-of-the-Week did not showed Spanish Language Accent for Wednesday (Miércoles) and Saturday (Sábado). So, I believe this solves it … I made changes on Sunday, so I´ll on Wednesday if this is really the solution.
wombat1 Friendwombat1
- Join date:
- March 2010
- Posts:
- 117
- Downloads:
- 0
- Uploads:
- 1
- Thanks:
- 38
- Thanked:
- 11 times in 1 posts
June 24, 2010 at 7:06 am #347915How to apply this to code edit for Madrid GMT +1
I used
$tz=+1;
return date("h:i:s A", $sec+ $tz*3600 ).' GMT';but its not working
do i have to edit the 3600
Also is this automatically going to change during daylight savings or does it have to be edited manually.Thanks in advance.
<em>@paellas 176511 wrote:</em><blockquote>:)
Replaced PHP Code:
———————-
[PHP]
return gmdate(“h:i:s A”, $sec+$tz).’ GMT’;
[/PHP]With PHP Code:
——————
[PHP]
$tz=-5;
return date(“h:i:s A”, $sec+ $tz*3600 ).’ GMT’;
[/PHP]</blockquote>
Saguaros ModeratorSaguaros
- Join date:
- September 2014
- Posts:
- 31405
- Downloads:
- 237
- Uploads:
- 471
- Thanks:
- 845
- Thanked:
- 5346 times in 4964 posts
July 1, 2010 at 9:48 am #348647did you try to use this :
[PHP]
$tz=+1;
return gmdate(“h:i:s A”, $sec+ $tz*3600 ).’ GMT’;
[/PHP]wombat1 Friendwombat1
- Join date:
- March 2010
- Posts:
- 117
- Downloads:
- 0
- Uploads:
- 1
- Thanks:
- 38
- Thanked:
- 11 times in 1 posts
July 1, 2010 at 10:00 pm #348713ah, i had used the following
$tz=+1;
return date(“h:i:s A”, $sec+ $tz*3600 ).’ GMT’;Perhaps you could clarify so that others that see this thread will know what to do and why.
Why is this the different with the code that you gave Paellas a few posts earlier$tz=-5;
return date(“h:i:s A”, $sec+ $tz*3600 ).’ GMT’;in his case it was
date
for me it is
gmdateWhen should users apply one and not the other.
Also if you can you confirm that this code will work when it is daylight savings. i.e. when the time is moved forward one hour for part of the year.
I think this would be a great help to others interested in this topic.
Thanks very much.
<em>@tienhc 184847 wrote:</em><blockquote>did you try to use this :
[PHP]
$tz=+1;
return gmdate(“h:i:s A”, $sec+ $tz*3600 ).’ GMT’;
[/PHP]</blockquote>Saguaros ModeratorSaguaros
- Join date:
- September 2014
- Posts:
- 31405
- Downloads:
- 237
- Uploads:
- 471
- Thanks:
- 845
- Thanked:
- 5346 times in 4964 posts
July 5, 2010 at 2:51 am #348919Dear wombat1!
i’m very sorry,
i had a big mistaken on this,
here is right:
[PHP]
$tz=1;
return date(“h:i:s A”, $sec+ $tz*3600 ).’ GMT’;
[/PHP]i worked well on my site after i checked this so many time.
-
AuthorPosts
This topic contains 28 replies, has 5 voices, and was last updated by Saguaros 14 years, 4 months ago.
We moved to new unified forum. Please post all new support queries in our New Forum