Keyword

How to change date format?

  • Johann Scharfetter
  • Johann Scharfetter's Avatar Topic Author
  • Offline
  • Senior Member
More
11 years 5 months ago #112120 by Johann Scharfetter
How to change date format? was created by Johann Scharfetter
Joomla 2.5
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
  • Mohamed Abdelaziz's Avatar
  • Offline
  • Platinum Member
  • Joomla Developer
More
11 years 5 months ago #112121 by Mohamed Abdelaziz
Replied by Mohamed Abdelaziz on topic Re: How to change date format?
You can change the date format in the template files or in the language file.
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
  • Johann Scharfetter's Avatar Topic Author
  • Offline
  • Senior Member
More
11 years 5 months ago - 11 years 5 months ago #112122 by Johann Scharfetter
Replied by Johann Scharfetter on topic Re: How to change date format?
I use Joomla 2.5. and for me worked this:

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
  • Mohamed Abdelaziz's Avatar
  • Offline
  • Platinum Member
  • Joomla Developer
More
11 years 5 months ago #112123 by Mohamed Abdelaziz
Replied by Mohamed Abdelaziz on topic Re: How to change date format?
I thinki you don't modify the correct file, you need to modify this file:
/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
  • Johann Scharfetter's Avatar Topic Author
  • Offline
  • Senior Member
More
11 years 5 months ago - 11 years 5 months ago #112124 by Johann Scharfetter
Replied by Johann Scharfetter on topic Re: How to change date format?
The contetn module shows this date

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
  • Johann Scharfetter's Avatar Topic Author
  • Offline
  • Senior Member
More
11 years 3 months ago - 11 years 3 months ago #112125 by Johann Scharfetter
Replied by Johann Scharfetter on topic SOLVED Re: How to change date format?
Hi,

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
  • Comercio de Uruapan's Avatar
  • Offline
  • New Member
More
10 years 10 months ago #112126 by Comercio de Uruapan
Replied by Comercio de Uruapan on topic Re: SOLVED Re: How to change date format?
Ok, yo lo resolví de la siguiente manera:

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.

More
10 years 8 months ago #112127 by Jan
Replied by Jan on topic Re: How to change date format?
Hi,

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
  • Yiota's Avatar
  • Visitor
10 years 8 months ago #112128 by Yiota
Replied by Yiota on topic Re: How to change date format?
You have to change the K2_DATE_FORMAT_LC2 in the en-GB.mod_k2_comments.ini file as well.

Please Log in or Create an account to join the conversation.

More
10 years 8 months ago #112129 by Jan
Replied by Jan on topic Re: How to change date format?
I'm sorry but even if I change it in both files there is no result in the module in frontend.

Please Log in or Create an account to join the conversation.


Powered by Kunena Forum