private static void formatTimeZone(Calendar cal,StringBuilder buf){
  TimeZone tz=cal.getTimeZone();
  if (tz == null)   return;
  int offset;
  if (tz.inDaylightTime(cal.getTime())) {
    offset=tz.getRawOffset() + (tz.useDaylightTime() ? 3600000 : 0);
  }
 else {
    offset=tz.getRawOffset();
  }
  if (offset == 0) {
    buf.append('Z');
    return;
  }
  if (offset >= 0)   buf.append('+');
 else {
    buf.append('-');
    offset*=-1;
  }
  offset/=60 * 1000;
  formatTwoDigits(offset / 60,buf);
  buf.append(':');
  formatTwoDigits(offset % 60,buf);
}

private static void formatTimeZone ( Calendar cal , StringBuilder buf ) { TimeZone tz = cal . getTimeZone ( ) ; if ( tz == null ) return ; int offset ; if ( tz . inDaylightTime ( cal . getTime ( ) ) ) { offset = tz . getRawOffset ( ) + ( tz . useDaylightTime ( ) ? 3600000 : 0 ) ; } else { offset = tz . getRawOffset ( ) ; } if ( offset == 0 ) { buf . append ( 'Z' ) ; return ; } if ( offset >= 0 ) buf . append ( '+' ) ; else { buf . append ( '-' ) ; offset *= - 1 ; } offset /= 60 * 1000 ; formatTwoDigits ( offset / 60 , buf ) ; buf . append ( ':' ) ; formatTwoDigits ( offset % 60 , buf ) ; }
formats time zone specifier .
