
« Back to Configure time...
add non-standard timezones
Note that the specified new timezone ids must match those from the class java.util.TimeZone, that may meet most of requires, but if you still want to add a non-standard timezone or want to show a different TimeZone name, then can follow these steps:
1. Add your TimezoneID in portal-ext.properties file:
For example: I add "Australia/WST'(+07:30)" in portal-ext.properties
Asia/Saigon,\
Australia/WST,\
Asia/Shanghai,\
2. Update html\taglib\ui\input_time_zone\page.jsp in your ext environment:
for (int i = 0; i < timeZones.length; i++) { if(timeZones[i].equals("Australia/WST")){ %> <option <%= value.equals("Australia/WST") ? "selected" : "" %> value="Australia/WST">(UTC +07:30) <%= LanguageUtil.get(pageContext, "australia-wst") %></option> <% } else{ TimeZone curTimeZone = TimeZone.getTimeZone(timeZones[i]); int rawOffset = curTimeZone.getRawOffset(); String offset = StringPool.BLANK; if (rawOffset > 0) { offset = "+"; } if (rawOffset != 0) { String offsetHour = numberFormat.format(rawOffset / Time.HOUR); String offsetMinute = numberFormat.format(Math.abs(rawOffset % Time.HOUR) / Time.MINUTE); offset += offsetHour + ":" + offsetMinute; } %> <option <%= value.equals(curTimeZone.getID()) ? "selected" : "" %> value="<%= curTimeZone.getID() %>">(UTC <%= offset %>) <%= curTimeZone.getDisplayName(daylight, displayStyle, locale) %></option> <% } } |
30448 Views