掲示板

Military time?

15年前 に Martin Kofoed によって更新されました。

Military time?

New Member 投稿: 15 参加年月日: 09/02/23 最新の投稿
Hi,

Is it possible to configure the portal to use military time (0-23h) instead of the default 12h representation? People here in Europe just don't understand that AM/PM thing... :-)

IF changing this is possible, will it have an impact on portlets as well? Most notably the calendar portlet ...

Regards,
Martin
15年前 に Martin Kofoed によって更新されました。

RE: Military time?

New Member 投稿: 15 参加年月日: 09/02/23 最新の投稿
Is this really not possible? So Locale-awareness is only for language and not date/time? Perhaps that should be made clear somewhere...
thumbnail
15年前 に Victor Zorin によって更新されました。

RE: Military time?

Liferay Legend 投稿: 1228 参加年月日: 08/04/14 最新の投稿
Should extract default setting from locale from 5.1.2, see LEP-6827,
also related post Non-US Date ....

This is extract from inside, com.liferay.ortal.util.DateFormats
	public static DateFormat getDateTime(Locale locale, TimeZone timeZone) {
		DateFormat df = DateFormat.getDateTimeInstance(
			DateFormat.SHORT, DateFormat.SHORT, locale);

		if (timeZone != null) {
			df.setTimeZone(timeZone);
		}

		return df;
	}

	public static DateFormat getTime(Locale locale) {
		return getTime(locale, null);
	}

	public static DateFormat getTime(Locale locale, TimeZone timeZone) {
		DateFormat df = DateFormat.getTimeInstance(DateFormat.SHORT, locale);

		if (timeZone != null) {
			df.setTimeZone(timeZone);
		}

		return df;
	}

15年前 に Martin Kofoed によって更新されました。

RE: Military time?

New Member 投稿: 15 参加年月日: 09/02/23 最新の投稿
Thanks, Victor.

That should solve the case for all users with browsers set according to country/language.

But it would still be more flexible to make an override possible through the user's account settings. Think I'll look into if this is easy to achieve..
thumbnail
15年前 に Victor Zorin によって更新されました。

RE: Military time?

Liferay Legend 投稿: 1228 参加年月日: 08/04/14 最新の投稿
But it would still be more flexible to make an override possible through the user's account settings

It is flexible now and you can change it at run-time for a selected user. Below are the screendumps on 5.1.2 version to display how locale change for me from 'English US' to 'English Australia' changes the display of event within the calendar portlet.
#1. australian locale setting for user
#2. calendar event displaying time in 24hr format
#3. us locale setting for user
#4. same calendar event display time in am/pm format
15年前 に Martin Kofoed によって更新されました。

RE: Military time?

New Member 投稿: 15 参加年月日: 09/02/23 最新の投稿
Thanks again, Victor..

However, this functionality seems to be gone missing (or moved to somewhere hard to find) in version 5.2.1?

What I have done now is setting the default locale to en_GB and allowing the browser locale as default unauthorized locale.

It would still be nice to override per user. It must still be there somewhere?!
15年前 に Martin Kofoed によって更新されました。

RE: Military time?

New Member 投稿: 15 参加年月日: 09/02/23 最新の投稿
Damn, I was just blind, sorry. Of course it's present in 5.2.x as well.

Thanks again, Victor emoticon