code: public static DateFormat customizeDateFormat(DateFormat formatter, boolean isoDateFormat) {
          String pattern;
          int patternLength;
          int endOfSecsIndex;
  
          if (!!!isoDateFormat) {
              if (formatter instanceof SimpleDateFormat) {
                  // Retrieve the pattern from the formatter, since we will need to modify it.
                  SimpleDateFormat sdFormatter = (SimpleDateFormat) formatter;
                  pattern = sdFormatter.toPattern();
                  // Append milliseconds and timezone after seconds
                  patternLength = pattern.length();
                  endOfSecsIndex = pattern.lastIndexOf('s') + 1;
                  String newPattern = pattern.substring(0, endOfSecsIndex) + ":SSS z";
                  if (endOfSecsIndex < patternLength)
                      newPattern += pattern.substring(endOfSecsIndex, patternLength);
                  // 0-23 hour clock (get rid of any other clock formats and am/pm)
                  newPattern = newPattern.replace('h', 'H');
                  newPattern = newPattern.replace('K', 'H');
                  newPattern = newPattern.replace('k', 'H');
                  newPattern = newPattern.replace('a', ' ');
                  newPattern = newPattern.trim();
                  sdFormatter.applyPattern(newPattern);
                  formatter = sdFormatter;
              } else {
                  formatter = new SimpleDateFormat("yy.MM.dd HH:mm:ss:SSS z");
              }
  
          } else {
              formatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ");
          }
          // PK13288 Start -
          if (sysTimeZone != null) {
              formatter.setTimeZone(sysTimeZone);
          }
          // PK13288 End
          return formatter;
      }
docs: Modifies an existing DateFormat object so that it can be used to format timestamps in the
  System.out, System.err and TraceOutput logs using either default date and time format or
  ISO-8601 date and time format
  
  @param formatter DateFormat object to be modified
  @param flag to use ISO-8601 date format for output.
  
  @return DateFormat object with adjusted pattern