@Override public boolean print(DateTimePrintContext context, StringBuilder buf) { ZoneId zone = context.getValue(TemporalQueries.zoneId()); if (zone == null) { return false; } if (zone.normalized() instanceof ZoneOffset) { buf.append(zone.getId()); return true; } TemporalAccessor temporal = context.getTemporal(); boolean daylight = false; if (temporal.isSupported(INSTANT_SECONDS)) { Instant instant = Instant.ofEpochSecond(temporal.getLong(INSTANT_SECONDS)); daylight = zone.getRules().isDaylightSavings(instant); } TimeZone tz = TimeZone.getTimeZone(zone.getId()); int tzstyle = (textStyle.asNormal() == TextStyle.FULL ? TimeZone.LONG : TimeZone.SHORT); String text = tz.getDisplayName(daylight, tzstyle, context.getLocale()); buf.append(text); return true; }
@Override public boolean print(DateTimePrintContext context, StringBuilder buf) { ZoneId zone = context.getValue(TemporalQueries.zoneId()); if (zone == null) { return false; } if (zone.normalized() instanceof ZoneOffset) { buf.append(zone.getId()); return true; } TemporalAccessor temporal = context.getTemporal(); boolean daylight = false; if (temporal.isSupported(INSTANT_SECONDS)) { Instant instant = Instant.ofEpochSecond(temporal.getLong(INSTANT_SECONDS)); daylight = zone.getRules().isDaylightSavings(instant); } TimeZone tz = TimeZone.getTimeZone(zone.getId()); int tzstyle = (textStyle.asNormal() == TextStyle.FULL ? TimeZone.LONG : TimeZone.SHORT); String text = tz.getDisplayName(daylight, tzstyle, context.getLocale()); buf.append(text); return true; }
ZoneId normalizedOffset = overrideZone.normalized(); ZoneOffset temporalOffset = temporal.query(TemporalQueries.offset()); if (normalizedOffset instanceof ZoneOffset && temporalOffset != null && normalizedOffset.equals(temporalOffset) == false) {
ZoneId normalizedOffset = overrideZone.normalized(); ZoneOffset temporalOffset = temporal.query(TemporalQueries.offset()); if (normalizedOffset instanceof ZoneOffset && temporalOffset != null && normalizedOffset.equals(temporalOffset) == false) {