void formatDayPeriod ( StringBuilder b , ZonedDateTime d , int width , FieldVariants dayPeriods ) { int hours = d . getHour ( ) ; int index = hours < 12 ? 0 : 1 ; switch ( width ) { case 5 : b . append ( dayPeriods . narrow [ index ] ) ; break ; case 4 : b . append ( dayPeriods . wide [ index ] ) ; break ; case 3 : case 2 : case 1 : b . append ( dayPeriods . abbreviated [ index ] ) ; break ; } }
Format the day period variant .