-
AuthorPosts
-
October 31, 2009 at 4:05 pm #322199
<em>@gray 151023 wrote:</em><blockquote>try
[php]
setlocale(LC_TIME, array(‘fr_FR’, ‘fr’, ‘fre’, ‘fr_FR.UTF8’));
echo strftime(” %A, %d. %B %Y n”);
[/php]</blockquote>where i put this php code? please give me more details. I am novice.
thank you
gray Friendgray
- Join date:
- October 2009
- Posts:
- 957
- Downloads:
- 0
- Uploads:
- 17
- Thanks:
- 28
- Thanked:
- 292 times in 230 posts
October 31, 2009 at 6:36 pm #322214Go to templatesja_teline_iiilayoutsblocksheader.php
Look for
[php]
<p class=”ja-day”>
<?php
echo “<span class=”day”>”.date (‘l’).”</span>”;
echo “<span class=”date”>, “.date (‘M’).” “.date (‘d’).date (‘S’).”</span>”;
?>
</p>
[/php]replace with
[php]
<p class=”ja-day”>
<?php
setlocale(LC_TIME, array(‘fr_FR’, ‘fr’, ‘fre’, ‘fr_FR.UTF8’));
echo strftime(” %A, %d. %B %Y n”);
?>
</p>
[/php]1 user says Thank You to gray for this useful post
October 31, 2009 at 7:27 pm #322215thank you, it’s work
cclaerhout Friendcclaerhout
- Join date:
- February 2009
- Posts:
- 2
- Downloads:
- 0
- Uploads:
- 0
- Thanked:
- 3 times in 1 posts
November 8, 2009 at 10:00 pm #322975Here’s a code for French, Traditional Chinese (Taiwan) and English language compatible with Joomfish.
[PHP] <p class=”ja-day”>
<?php
if ($this->language==”fr-fr”)
{
$date_l = date(“l”);
$days = array(‘Monday’,’Tuesday’,’Wednesday’,’Thursday’,’Friday’,’Saturday’,’Sunday’);
$jours = array(‘Lundi’,’Mardi’,’Mercredi’,’Jeudi’,’Vendredi’,’Samedi’,’Dimanche’);
$date_l = str_replace($days, $jours, $date_l);$date_F = date(“F”);
$months = array(‘January’,’February’,’March’,’April’,’May’,’June’,’July’,’August’,’September’,’October’,’November’,’December’);
$mois = array(‘janvier’,’février’,’mars’,’avril’,’mai’,’juin’,’juillet’,’août’,’septembre’,’octobre’,’novembre’,’décembre’);
$date_F = str_replace($months, $mois, $date_F);echo “<span class=”day”>”. $date_l .”</span>”;
echo “<span class=”date”> “.date (‘d’).” “.$date_F.”</span>”;
}if ($this->language==”zh-tw”)
{
$date_l = date(“l”);
$days = array(‘Monday’,’Tuesday’,’Wednesday’,’Thursday’,’Friday’,’Saturday’,’Sunday’);
$tian = array(‘禮拜一’,’禮拜二’,’禮拜三’,’禮拜四’,’禮拜五’,’禮拜六’,’禮拜天’);
$date_l = str_replace($days, $tian, $date_l);$date_F = date(“F”);
$months = array(‘January’,’February’,’March’,’April’,’May’,’June’,’July’,’August’,’September’,’October’,’November’,’December’);
$yue = array(‘一月’,’二月’,’三月’,’四月’,’五月’,’六月’,’七月’,’八月’,’九月’,’十月’,’十一月’,’十二月’);
$date_F = str_replace($months, $yue, $date_F);$date_d = date(“d”);
$months = array(’01’,’02’,’03’,’04’,’05’,’06’,’07’,’08’,’09’,’10’,’11’,’12’,’13’,’14’,’15’,’16’,’17’,’18’,’19’,’20’,’21’,’22’,’23’,’24’,’25’,’26’,’27’,’28’,’29’,’30’,’31’);
$hao = array(‘一號’,’二號’,’三號’,’四號’,’五號’,’六號’,’七號’,’八號’,’九號’,’十號’,’十一號’,’十二號’,’十三號’,’十四號’,’十五號’,’十六號’,’十七號’,’十八號’,’十九號’,’二十號’,’二十一號’,’二十二號’,’二十三號’,’二十四號’,’二十五號’,’二十六號’,’二十七號’,’二十八號’,’二十九號’,’三十號’,’三十一號’);
$date_d = str_replace($months, $hao, $date_d);echo “<span class=”date”>”.$date_F.” “.$date_d.”</span>”;
echo “<span class=”day”> “. $date_l .”</span>”;}
if ($this->language==”en-gb”)
{
echo “<span class=”day”>”.date (‘l’).”</span>”;
echo “<span class=”date”>, “.date (‘M’).” “.date (‘d’).date (‘S’).”</span>”;
}
?>
</p>[/PHP]Just need to fix the GMT per language and it should be perfect.
November 23, 2009 at 6:49 am #324656<em>@zipper 144437 wrote:</em><blockquote>
Too disable lastupdate, pull this line out:<p class="ja-updatetime"><span>Last update:</span><em><?php echo JATemplateHelper::getLastUpdate(); ?></em></p>
</blockquote>But how do I change it to my local time?
micrantha Friendmicrantha
- Join date:
- May 2007
- Posts:
- 465
- Downloads:
- 0
- Uploads:
- 6
- Thanks:
- 6
- Thanked:
- 158 times in 148 posts
November 27, 2009 at 1:02 pm #325136Hello berdal,
Maybe this helps on the way to an answer:
In ja_teline_iii/libs/ja.template.helper.php you can find this code:
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';
}
So it seems to me that these lines define the output of GMT.
I don’t know how to change these lines in order that the output is local time of Global Configs
Maybe somebody else can help further.gray Friendgray
- Join date:
- October 2009
- Posts:
- 957
- Downloads:
- 0
- Uploads:
- 17
- Thanks:
- 28
- Thanked:
- 292 times in 230 posts
November 27, 2009 at 6:14 pm #325156<em>@berdal 154234 wrote:</em><blockquote>But how do I change it to my local time?</blockquote>
This issue is discussed in this thread.
Hope it helps.micrantha Friendmicrantha
- Join date:
- May 2007
- Posts:
- 465
- Downloads:
- 0
- Uploads:
- 6
- Thanks:
- 6
- Thanked:
- 158 times in 148 posts
November 28, 2009 at 3:55 pm #325204OK, I can be more informative now, after friendly tip of Gray:
In my case I replaced original code line
return gmdate("h:i:s A", $sec+$tz).' GMT';
with
setlocale(LC_ALL, 'nl_NL'); //set the output in NL-language
return strftime( "%a %e %b %H:%M %Z" , $sec+$tz).' ';
Output: donderdag 26 nov 16:02 CETThis code also gives day and month of last site-update
As Gray pointed out: for specific php date formats open http://www.php.net/manual/en/ref.datetime.php
More format-info in:
gmdate(): http://www.php.net/manual/en/function.gmdate.php
setlocale(): http://www.php.net/manual/en/function.setlocale.php
strftime(): http://www.php.net/manual/en/function.strftime.phpJanuary 3, 2010 at 8:37 pm #328041Thanks alot for the help… I did figure it out. Now I have a different problem. If converting helper.php to UTF-8 (to allow the scandinavian letters æ, ø, å) the entire layout is pushed down apprx. 10px from the top. Do anyone have any idea what to do?
davidrabinov Frienddavidrabinov
- Join date:
- January 2010
- Posts:
- 128
- Downloads:
- 0
- Uploads:
- 5
- Thanks:
- 15
- Thanked:
- 1 times in 1 posts
January 5, 2010 at 4:33 pm #328301<em>@shelsoker 150159 wrote:</em><blockquote>Hi, if someone served the Spanish code, here is:
<?php
$datum = date(“j F Y”);
$dagvanweek = date(“l”);
$arraydag = array(
“Domingo”,
“Lunes”,
“Martes”,
“Miercoles”,
“Jueves”,
“Viernes”,
“Sabado”
);
$dagvanweek = $arraydag;
$arraymaand = array(
“Enero”,
“Febrero”,
“Marzo”,
“Abril”,
“Mayo”,
“Junio”,
“Julio”,
“Agosto”,
“Septiembre”,
“Octubre”,
“Noviembre”,
“Diciembre”
);
$datum = date(“j “) . $arraymaand
. date(” Y”);
echo “$dagvanweek, $datum”;
?>
</p></blockquote>This one works, but you’re need to add the Tilde in Miércoles & Sábado
This is what I’m using for Spanish date
<?php
setlocale(LC_TIME, 'es_ES.UTF-8'); // Para el caso necesito UTF-8. Creo que por defecto es ISO-8859-1.
$fecha= strftime('%A %e de %B de %Y');
$fecha= ucfirst($fecha);
echo $fecha; // muestra "Lunes 17 de septiembre de 2007"
?>The only thing here is i can’t figure out how to make the month start with a capital letter, if any ones knows, please let me know.
gray Friendgray
- Join date:
- October 2009
- Posts:
- 957
- Downloads:
- 0
- Uploads:
- 17
- Thanks:
- 28
- Thanked:
- 292 times in 230 posts
January 5, 2010 at 5:36 pm #328311<em>@davidrabinov 159096 wrote:</em><blockquote>
The only thing here is i can’t figure out how to make the month start with a capital letter, if any ones knows, please let me know.</blockquote>The code used in strftime(‘%A %e de %B de %Y’) should display the month capitalized.
But when ucfirst is applied, it return only first letter capitalized. Try to remove it.PS. I’ve looked at php manual, it seems that removing ucfirst would not help….
bucakli Friendbucakli
- Join date:
- February 2010
- Posts:
- 20
- Downloads:
- 0
- Uploads:
- 4
- Thanks:
- 7
- Thanked:
- 1 times in 1 posts
February 3, 2010 at 6:07 pm #331442i m using turkish in my site
can you tell for turkish?Anonymous ModeratorJA Developer
- Join date:
- September 2014
- Posts:
- 9914
- Downloads:
- 207
- Uploads:
- 152
- Thanks:
- 1789
- Thanked:
- 2008 times in 1700 posts
February 6, 2010 at 10:11 am #331807Hi guys
The below is a way to translate current date to your language use multi languages. the mean is that if you switch to other language, current date will change to that language.
1. Open templatesja_teline_iiilayoutsblocksheader.php file, find following code section:
[PHP]<p class=”ja-day”>
<?php
echo “<span class=”day”>”.date (‘l’).”</span>”;
echo “<span class=”date”>, “.date (‘M’).” “.date (‘d’).date (‘S’).”</span>”;
?>
</p>[/PHP]and change to:
[PHP]<p class=”ja-day”>
<?php
echo “<span class=”day”>”.JText::_(date (‘l’)).”</span>”;
echo “<span class=”date”>, “. JText::_(date (‘M’)) .” “.JText::_(date (‘d’)).JText::_(date (‘S’)).”</span>”;
?>
</p>[/PHP]2. Open languages/your language / your_language.ini file (ex: languageen-GBen-GB.ini) to define some text
For an example: you see Saturday, Feb 06th on the frontpageYou have to translate all days (Saturday) and all short months (ex: Feb) to your language with the structure:
The structure:
UPPERCASE WORD = your languageExample:
SATURDAY = saturday
FEB = febNote: you should search this text in the file to make sure that this text is not exist yet.
With this code, if you switch to other language, the date will change to your language.
Hope it helps
7 users say Thank You to JA Developer for this useful post
bucakli Friendbucakli
- Join date:
- February 2010
- Posts:
- 20
- Downloads:
- 0
- Uploads:
- 4
- Thanks:
- 7
- Thanked:
- 1 times in 1 posts
February 6, 2010 at 6:09 pm #331829i changed
<p class=”ja-day”>
<?php
echo “<span class=”date”>”. JText::_(date (‘d’)) .” / “.JText::_(date (‘m’)).” / “.JText::_(date (‘Y’)).”</span>”;
echo “<span class=”day”> – “.JText::_(date (‘l’)).”</span>”;?>
i solved 06/02/2010 – Cumartesi but i didnot 06 Şubat 2010 – Cumartesi month language always english
but thank you my friend
gray Friendgray
- Join date:
- October 2009
- Posts:
- 957
- Downloads:
- 0
- Uploads:
- 17
- Thanks:
- 28
- Thanked:
- 292 times in 230 posts
February 6, 2010 at 7:56 pm #331834JA Developer
I’ve implemented this approach already (I posted here the same solution).It would be great to include this code in the next release of Teline III, isn’t it?
-
AuthorPosts
This topic contains 61 replies, has 30 voices, and was last updated by euroadvltd 12 years, 5 months ago.
We moved to new unified forum. Please post all new support queries in our New Forum