264 int offset = (tz.getRawOffset() + (daylight ? tz.getDSTSavings() : 0)) / 60000;
265 LocaleResources lr = LocaleProviderAdapter.forType(Type.CLDR).getLocaleResources(l);
266 ResourceBundle fd = lr.getJavaTimeFormatData();
267
268 if (offset == 0) {
269 return fd.getString("timezone.gmtZeroFormat");
270 } else {
271 String gmtFormat = fd.getString("timezone.gmtFormat");
272 String hourFormat = fd.getString("timezone.hourFormat");
273
274 if (offset > 0) {
275 hourFormat = hourFormat.substring(0, hourFormat.indexOf(";"));
276 } else {
277 hourFormat = hourFormat.substring(hourFormat.indexOf(";") + 1);
278 offset = -offset;
279 }
280 hourFormat = hourFormat
281 .replaceFirst("H+", (isShort ? "\\%1\\$d" : "\\%1\\$02d"))
282 .replaceFirst("m+", "\\%2\\$02d");
283 return MessageFormat.format(gmtFormat,
284 String.format(hourFormat, offset / 60, offset % 60));
285 }
286 }
287 }
|
264 int offset = (tz.getRawOffset() + (daylight ? tz.getDSTSavings() : 0)) / 60000;
265 LocaleResources lr = LocaleProviderAdapter.forType(Type.CLDR).getLocaleResources(l);
266 ResourceBundle fd = lr.getJavaTimeFormatData();
267
268 if (offset == 0) {
269 return fd.getString("timezone.gmtZeroFormat");
270 } else {
271 String gmtFormat = fd.getString("timezone.gmtFormat");
272 String hourFormat = fd.getString("timezone.hourFormat");
273
274 if (offset > 0) {
275 hourFormat = hourFormat.substring(0, hourFormat.indexOf(";"));
276 } else {
277 hourFormat = hourFormat.substring(hourFormat.indexOf(";") + 1);
278 offset = -offset;
279 }
280 hourFormat = hourFormat
281 .replaceFirst("H+", (isShort ? "\\%1\\$d" : "\\%1\\$02d"))
282 .replaceFirst("m+", "\\%2\\$02d");
283 return MessageFormat.format(gmtFormat,
284 String.format(l, hourFormat, offset / 60, offset % 60));
285 }
286 }
287 }
|