void formatTimeZone_z ( StringBuilder b , ZonedDateTime d , int width ) { if ( width > 4 ) { return ; } ZoneId zone = d . getZone ( ) ; ZoneRules zoneRules = null ; try { zoneRules = zone . getRules ( ) ; } catch ( ZoneRulesException e ) { // not expected, but catching for safety return ; } boolean daylight = zoneRules . isDaylightSavings ( d . toInstant ( ) ) ; // Select long or short name variants and select the standard or daylight name. Name variants = getTimeZoneName ( zone . getId ( ) , d , width == 4 ) ; String name = variants == null ? null : ( daylight ? variants . daylight ( ) : variants . standard ( ) ) ; switch ( width ) { case 4 : { if ( name != null ) { b . append ( name ) ; } else { // Falls back to 'OOOO' formatTimeZone_O ( b , d , 4 ) ; } break ; } case 3 : case 2 : case 1 : { if ( name != null ) { b . append ( name ) ; } else { // Falls back to 'O' formatTimeZone_O ( b , d , 1 ) ; } break ; } } }
Format a time zone using a non - location format .