掲示板

Timezones available

7年前 に Gustavo Vázquez によって更新されました。

Timezones available

New Member 投稿: 7 参加年月日: 16/12/14 最新の投稿
In the visualization preferences for the portal, we have a combo list with a set of timezones that is not complete. For example America/Montevideo is nost available. The only GMT -3 is Brasil, but it has DST, so at this part of the year, i have a 1 hour shift.

We have read that we can add other timezones in portal-ext.properties (under the time.zones variable) but we had no luck. Is this OK? Is there any way to enhace that list with new timezones?

We are using Liferay 6.

Thanks in advance
Gustavo.-
thumbnail
7年前 に Andrew Jardine によって更新されました。

RE: Timezones available

Liferay Legend 投稿: 2416 参加年月日: 10/12/22 最新の投稿
Hi Gustavo --

6 -- as in 6.0? or 6.1? 6.2? .. CE? EE? if it is CE, which GA release. This is all important information for any reader that is hoping to try to reproduce what you are reporting.
7年前 に Gustavo Vázquez によって更新されました。

RE: Timezones available

New Member 投稿: 7 参加年月日: 16/12/14 最新の投稿
Andrew, sorry for the lack of information.
I'm talking about Liferay 6.1.1 CE GA.

Thanks in advance
Gustavo.
thumbnail
7年前 に Andrew Jardine によって更新されました。

RE: Timezones available

Liferay Legend 投稿: 2416 参加年月日: 10/12/22 最新の投稿
Can you share with me the configuration that you are trying in your portal-ext?
thumbnail
7年前 に David H Nebinger によって更新されました。

RE: Timezones available

Liferay Legend 投稿: 14919 参加年月日: 06/09/02 最新の投稿
6.1.1 GA is pretty old. You should be at least on 6.1.2 GA3 as it has some number of bugfixes over the original GA.
7年前 に Gustavo Vázquez によって更新されました。

RE: Timezones available

New Member 投稿: 7 参加年月日: 16/12/14 最新の投稿
Here goes the configuration file.

Thanks in advance!
thumbnail
7年前 に Andrew Jardine によって更新されました。

RE: Timezones available

Liferay Legend 投稿: 2416 参加年月日: 10/12/22 最新の投稿
Hi Gustavo,

Sorry for the delay -- but I think I've got something for you. I''ve used the time.zones line from your configuration file in a fresh 6.1.1 GA2 bundle on my side. When i started the portal and went to Portal Settings I was confused by the labels as they did not align with what was configured. I traced the timze.zone property (using TIME_ZONE) in the portal source and found the ui taglib "input_time_zone". There I could see

String[] timeZones = PropsUtil.getArray(PropsKeys.TIME_ZONES);
...
<%
	for (int i = 0; i < timeZones.length; i++) {
		TimeZone curTimeZone = TimeZoneUtil.getTimeZone(timeZones[i]);
...


So I felt validated that what I set in the String was being loaded. I followed the trail into the TimeZone util, which is a Liferay class, and then that took me into

private TimeZone _getTimeZone(String timeZoneId) {
		TimeZone timeZone = _timeZones.get(timeZoneId);

		if (timeZone == null) {
			timeZone = TimeZone.getTimeZone(timeZoneId);

			_timeZones.put(timeZoneId, timeZone);
		}

		return timeZone;
	}


.. and TimeZone is a java core class from the java.util package. In there I found this --

  private static TimeZone getTimeZone(String ID, boolean fallback) {
        TimeZone tz = ZoneInfo.getTimeZone(ID);
        if (tz == null) {
            tz = parseCustomTimeZone(ID);
            if (tz == null && fallback) {
                tz = new ZoneInfo(GMT_ID, 0);
            }
        }
        return tz;
    }


.. the interesting parameter is the fallback. My understanding is that if it doesn't find a match for the timezone you specify, it just uses some "equivalent" value if it can find one. I set my portal to use just time.zone=America/Toronto and when I restarted it showed me America/New York (we're in the same time zone) as the option. When I used just your Custom/GMT-3, I got UTC Greenwich Meantime -- but that isn't -3!

I next searched for the java class code on google. I'm not sure which version of the JVM you are using, so I am referencing 7 here -- but either way, note that I am now outside Liferay: https://docs.oracle.com/javase/7/docs/api/java/util/TimeZone.html

If you read the documentation at the top it talks about valid timezones and what you can use etc. I tried a few variations on Custom/GMT-3, but with no luck. In my searching though, interestingly, I found that GMT-3 is also know as "Papa" time in the military emoticon. Anyway, as a last ditch effort I decided to try JUST them timezone -- so I set this

time.zones=GMT-03:00


... restarted the portal and then found in my Portal Settings > Display Settings a single value in the drop down -- (UTC-03:00) GMT-03:00. It's not pretty, but it looks like it has the timezone you are after.

HTH
thumbnail
7年前 に Andrew Jardine によって更新されました。

RE: Timezones available

Liferay Legend 投稿: 2416 参加年月日: 10/12/22 最新の投稿
Link to the site with the names the military uses for time zones incase anyone is curious: https://www.timeanddate.com/worldclock/timezone/utc-3. Apparently, I am in "Romeo" -- not sure my wife would agree ;)
thumbnail
7年前 に Jack Bakker によって更新されました。

RE: Timezones available

Liferay Master 投稿: 978 参加年月日: 10/01/03 最新の投稿
Andrew Jardine:
Link to the site with the names the military uses for time zones incase anyone is curious: https://www.timeanddate.com/worldclock/timezone/utc-3. Apparently, I am in "Romeo" -- not sure my wife would agree ;)

Would Juliet have survived had Romeo and their Friar observed Daylight Savings Time ?
7年前 に Gustavo Vázquez によって更新されました。

RE: Timezones available

New Member 投稿: 7 参加年月日: 16/12/14 最新の投稿
Hi! I tried it and it works perfect and in the wanted way.

IThank you VERY much.

Thanks!
Gustavo.-
thumbnail
7年前 に Andrew Jardine によって更新されました。

RE: Timezones available

Liferay Legend 投稿: 2416 参加年月日: 10/12/22 最新の投稿
Looks like there was never any hope for Juliet ... I checked a few of the other timezones. Juliet was nowhere to be found. Her fate was sealed from the outset it seems emoticon