- Posts: 58
COMMUNITY FORUM
How to change date format?
- Johann Scharfetter
-
Topic Author
- Offline
- Senior Member
K2 v2.6.5
Hi,
sorry for asking such a basic question, but... I am searching for one hour now without finding a solution.
How do I change the date format?
a) for component
b) for the modules (i.e. latest items module)
I tried to change all language files I found without success.
It seems there is a lot of confusion concerning this topic. I read several threads but without finding a solution. Maybee we could create a thread to solve this topice once for all.
Thank you!
Please Log in or Create an account to join the conversation.
- Mohamed Abdelaziz
-
- Offline
- Platinum Member
- Joomla Developer
In the template fiels you can change K2_DATE_FORMAT_LC2 to K2_DATE_FORMAT_LC2 or K2_DATE_FORMAT to choose other formats.
And in the language file you can change in the format itself, for example, you can change the separator or the ordering of date parts.
Multiple Extra Fields Groups for K2
AutoMeta for K2
Chained Fields for K2
More K2 Extensions In My Extensions Store
Please Log in or Create an account to join the conversation.
- Johann Scharfetter
-
Topic Author
- Offline
- Senior Member
- Posts: 58
I understand that in item.php and category-item.php I can change the date style. But in my case I did not chane anything. I left this date style K2_DATE_FORMAT_LC2. In the modules the same style is used.
___________________
For the items and category views I changed this file:
/administrator/languages/en-GB/en-GB.com_k2.j16.ini
or your specific website language, like spanish:
/administrator/languages/es-ES/es-ES.com_k2.j16.ini
I changed this line: K2_DATE_FORMAT_LC2="d F Y"
All other language files I changed did not show any efects
___________________
But I do not know how to change the date format of the modules? I spent 3 hours without success.
How to change the date format of k2 content module? Please give us a detailed answer.
Thank you!
Please Log in or Create an account to join the conversation.
- Mohamed Abdelaziz
-
- Offline
- Platinum Member
- Joomla Developer
/languages/en-GB/en-GB.com_k2.ini
/languages/en-GB/en-GB.mod_k2_content.ini
You can read this page: php.net/manual/en/function.strftime.php for more details about the available parameters and their description
Multiple Extra Fields Groups for K2
AutoMeta for K2
Chained Fields for K2
More K2 Extensions In My Extensions Store
Please Log in or Create an account to join the conversation.
- Johann Scharfetter
-
Topic Author
- Offline
- Senior Member
- Posts: 58
Publicado el Viernes, 19 Abril 2013 09:34
when I delete the file es-ES.mod_k2_content.ini the date format stays the same as you can see below, only the K2_WRITTEN_ON=".." changes.
Written on Viernes, 19 Abril 2013 09:34
And in the es-ES.mod_k2_content.ini-file I have this code:
K2_DATE_FORMAT_LC2="%d %B %Y "
K2_DATE_FORMAT_LC="%A, %d %B %Y"
So Hour and Minutes sould not be displayes, but they are dispalyed as you can see above.
This means that the date format for the module has to be modified in an other file, but which one?
Thank you.
Please Log in or Create an account to join the conversation.
- Johann Scharfetter
-
Topic Author
- Offline
- Senior Member
- Posts: 58
after long time I found out how to solve this.
In spanish language the date is written like this, 4 de Enero 2013.
So how to add te "de"??
p.e.
JANUARY="Enero"
to
JANUARY="de Enero"
The corresponend language file is the following /languages/es-ES(or other)/es-ES.ini.
But it is better to make a language override.
I made a language override in the Joomla admin: /Joomla > Extensions > Language manager > Overrides
there I worte for example:
JANNUARY de Enero
Please Log in or Create an account to join the conversation.
- Comercio de Uruapan
-
- Offline
- New Member
Agregué: K2_DATE_FORMAT_LC2, a los Overrides de mi página, según el idioma de que se trate...
Valor: l, j \d\e F \d\e Y, \a \l\a\s g:i:s a
Esto me dá como resultado: Domingo, 1 de Diciembre de 2013 a las 11:18:26 am
Espero que alguine más lo pueda utilizar...
¡Saludos y bendiciones...
Please Log in or Create an account to join the conversation.
- Jan
-
- Offline
- New Member
- Posts: 10
I also have the Problem that I would like to change the date format of
K2_DATE_FORMAT_LC2 from
"%A, %d %B %Y %H:%M"
to
"%A, %d %B %Y | %H:%M"
but everything I tried went wrong. I changed all Keys I found called K2_DATE_FORMAT_LC2 but none of them changed the date format in the frontend comment module...
Where do I have to look for rhe right file?
Please Log in or Create an account to join the conversation.
- Yiota
-
- Visitor
Please Log in or Create an account to join the conversation.
- Jan
-
- Offline
- New Member
- Posts: 10
Please Log in or Create an account to join the conversation.
- Yiota
-
- Visitor
Please Log in or Create an account to join the conversation.
- Jan
-
- Offline
- New Member
- Posts: 10
Thats no relative time stamp in my opinion, is it?
Please Log in or Create an account to join the conversation.
- Yiota
-
- Visitor
Please Log in or Create an account to join the conversation.
- Jan
-
- Offline
- New Member
- Posts: 10
Please Log in or Create an account to join the conversation.
- Yiota
-
- Visitor
Please Log in or Create an account to join the conversation.
- Jan
-
- Offline
- New Member
- Posts: 10
Its in the de-DE.mod_k2.j16.ini for the module output and in the de-DE.com_k2.j16.ini for the component output.
Both files are in the administrator > language folder...
So now i want to add some text to the translation. But the way I did it was not accepted... Why not?
I changed
K2_DATE_FORMAT_LC2="l, d F Y H:i"
into
K2_DATE_FORMAT_LC2="l, d F Y um H:i"
and the output is like
auf Donnerstag, 30 Januar 2014 00000001 11:52.
Why?
Please Log in or Create an account to join the conversation.
- Lefteris
-
- Offline
- Platinum Member
- Posts: 8743
In case you need to add words I'm afraid that you have to break your date in two definitions, like
K2_DATE_FORMAT_LC2="l, d F Y"
K2_DATE_FORMAT_LC3="H:i"
and also change the file mod_k2_comments/comments.php (better create an template override of the module and make the modification there. Just copy the mod_k2_comments/tmpl/comments.php to templates/your_template/html/mod_k2_comments/).
Then locate this
<?php echo JText::_('K2_ON'); ?> <?php echo JHTML::_('date', $comment->commentDate, JText::_('K2_DATE_FORMAT_LC2')); ?>
and change it to this
<?php echo JText::_('K2_ON'); ?> <?php echo JHTML::_('date', $comment->commentDate, JText::_('K2_DATE_FORMAT_LC2')); ?> um <?php echo JHTML::_('date', $comment->commentDate, JText::_('K2_DATE_FORMAT_LC3')); ?>
Please Log in or Create an account to join the conversation.
- Jan
-
- Offline
- New Member
- Posts: 10
Please Log in or Create an account to join the conversation.
- Yiota
-
- Visitor
Please Log in or Create an account to join the conversation.
- Jan
-
- Offline
- New Member
- Posts: 10
Btw: Why do I have to enter a captcha code everytime I post something? That is really annoying...
Please Log in or Create an account to join the conversation.