Forums de discussion

Timezones available

Gustavo Vázquez, modifié il y a 7 années.

Timezones available

New Member Publications: 7 Date d'inscription: 14/12/16 Publications récentes
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
Andrew Jardine, modifié il y a 7 années.

RE: Timezones available

Liferay Legend Publications: 2416 Date d'inscription: 22/12/10 Publications récentes
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.
Gustavo Vázquez, modifié il y a 7 années.

RE: Timezones available

New Member Publications: 7 Date d'inscription: 14/12/16 Publications récentes
Andrew, sorry for the lack of information.
I'm talking about Liferay 6.1.1 CE GA.

Thanks in advance
Gustavo.
thumbnail
Andrew Jardine, modifié il y a 7 années.

RE: Timezones available

Liferay Legend Publications: 2416 Date d'inscription: 22/12/10 Publications récentes
Can you share with me the configuration that you are trying in your portal-ext?
thumbnail
David H Nebinger, modifié il y a 7 années.

RE: Timezones available

Liferay Legend Publications: 14914 Date d'inscription: 02/09/06 Publications récentes
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.
Gustavo Vázquez, modifié il y a 7 années.

RE: Timezones available

New Member Publications: 7 Date d'inscription: 14/12/16 Publications récentes
Here goes the configuration file.

Thanks in advance!
thumbnail
Andrew Jardine, modifié il y a 7 années.

RE: Timezones available

Liferay Legend Publications: 2416 Date d'inscription: 22/12/10 Publications récentes
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
Andrew Jardine, modifié il y a 7 années.

RE: Timezones available

Liferay Legend Publications: 2416 Date d'inscription: 22/12/10 Publications récentes
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
Jack Bakker, modifié il y a 7 années.

RE: Timezones available

Liferay Master Publications: 978 Date d'inscription: 03/01/10 Publications récentes
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 ?
Gustavo Vázquez, modifié il y a 7 années.

RE: Timezones available

New Member Publications: 7 Date d'inscription: 14/12/16 Publications récentes
Hi! I tried it and it works perfect and in the wanted way.

IThank you VERY much.

Thanks!
Gustavo.-
thumbnail
Andrew Jardine, modifié il y a 7 années.

RE: Timezones available

Liferay Legend Publications: 2416 Date d'inscription: 22/12/10 Publications récentes
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