RE: Re: [Liferay Forums][2. Using Liferay]Change date format

297230, modified 17 Years ago. Regular Member Posts: 103 Join Date: 11/27/07 Recent Posts
Since I live in Australia I would like to change the date format to DD/MM/YYYY rather than the default American format which has the month first. I would like to change it globally but in particular in the forums portlet as it could cause confusion. I thought it might be a global, user or locale setting but I cannot find it anywhere. Can anyone tell me how to change the date format? Thanks.
thumbnail
10527, modified 17 Years ago. Liferay Legend Posts: 1197 Join Date: 2/8/05 Recent Posts
> Since I live in Australia I would like to change the date format to DD/MM/YYYY rather than the default American format which has the month first. I would like to change it globally but in particular in the forums portlet as it could cause confusion. I thought it might be a global, user or locale setting but I cannot find it anywhere. Can anyone tell me how to change the date format? Thanks.

Hey Ben... this is actually a very simple fix... you can do it yourself
quite easily.

1) Add en_AU to the list of supported locales in
portal-ext.properties...

locales=ar_SA,ca_AD,ca_ES,zh_CN,zh_TW,cs_CZ,nl_NL,en_AU,....


2) Set the default portal Language/Country in system-ext.properties (put
this file in the same place as portal-ext.properties)

user.country=AU
user.language=en


3) (optional) In order for "English (Australia)"'s flag to appear
in the Language portlet, create a flag icon (16x11 pixels) and place it
in (all) the theme's images/language folder.

4) Restart portal...

Done! All the dates should be Aussi standard everywhere in the portal.
(I tested this to see if it really works and it really does... emoticon ).

5) (might not be required) If you're user is still displaying it's
current default language (en_US), change it in My Account... (you might
have to update all the user records in the DB and restart the portal to
re-set this globally for all your users).

You don't even need to worry about a translation to support the
en_AU because the default falls back to en... but you can always
add an en_AU translation as well.. we'd welcome the contribution back in
the portal.
297230, modified 17 Years ago. Regular Member Posts: 103 Join Date: 11/27/07 Recent Posts
Thanks for the detailed instructions Ray. It is good to know that it can be changed globally. I will give it a go.
thumbnail
1850990, modified 16 Years ago. Junior Member Posts: 46 Join Date: 12/30/08 Recent Posts
Hi,

I am also in Australia and have made the suggested changes. I am running 5.1.2 - I realise that this thread is a few years old but it's still relevant.

The date formats are still coming out in mm/dd/yy - I am looking at the modified date and created date for journal content.

In system-ext.properties I have:
user.country=AU
user.language=en

In portal-ext.properties I have:
locales=en_AU

Any help would be appreciated.

Thanks,
Paul
1235547, modified 16 Years ago. New Member Post: 1 Join Date: 8/28/08 Recent Posts
As outlined above, you need to the change the Language for the user. Try changing your own account first by select "My Account" in the drop down menu, and then change your language from English (USA) to English (Aus). If that works then you'll need to perform a update of the languageId column in the User_ table in your database. Since the Persistence layer probably has objects cached, I suspect it's best to do this while the portal instance is down. Then when it starts again the cache will get refreshed from the updated table.

Hope that helps.
S.
thumbnail
4542354, modified 15 Years ago. Junior Member Posts: 28 Join Date: 1/29/10 Recent Posts
Hi, I've been trying to implement the ISO YYYY-MM-DD format. I found that Sweden has that format of date, but I would like English. I thought maybe putting en_SE in portal-ext file and user.country=SE user.language=en in system-ext would let me do this but no luck. I do get the option in languages but date format is not changed. The native sv_SE does display ISO dates (but Swedish language). Any suggestions?
thumbnail
4753419, modified 15 Years ago. Liferay Legend Posts: 7942 Join Date: 3/24/10 Recent Posts
I'm also facing a similar problem. I live in Japan and the common date format is yyyy年mm月dd日 but Liferay display dates in yy/mm/dd.

I was able to display the date in the correct format on the Calendar porlet but inserting headerPattern = "yyyy年MM月dd日"; in the taglib\ui\calendar\page.jsp.

Would appreciate if someone can tell me a better way to solve this problem.
thumbnail
Shahbaz Khan, modified 6 Years ago. Junior Member Posts: 40 Join Date: 11/18/14 Recent Posts
Hi Ray,

Although it is a very old thread. But I have also similar requirements with slight modification.

My default locale is en_US. But I want to change date format for this locale also.

Is there any way to do this without changing default locale.
thumbnail
Olaf Kock, modified 6 Years ago. Liferay Legend Posts: 6441 Join Date: 9/23/08 Recent Posts
Shahbaz Khan

Although it is a very old thread. But I have also similar requirements with slight modification.

My default locale is en_US. But I want to change date format for this locale also.

Is there any way to do this without changing default locale.
The quickest way would include changing the default locale, but the effect is great: I'm using this forum in en_GB - Liferay doesn't have any specific GB-translation (e.g. color vs colour), but suddenly the dates used in this forum make sense to me.

AFAIK the formatting it left to the standard JVM routines for the locales. I've never checked if they're configurable, but that would be my other closest bet if you really insist on keeping en_US.
thumbnail
Shahbaz Khan, modified 6 Years ago. Junior Member Posts: 40 Join Date: 11/18/14 Recent Posts
Hi Olaf,


Thanks for the answer.

As of now I have changed my locale from en_US to en_GB to fix this problem.
thumbnail
Suresh Nimmakayala, modified 6 Years ago. Liferay Master Posts: 690 Join Date: 8/18/04 Recent Posts
it is easy as in 7.2 , nice feature can configure based on instance