code: @Override
      public int doEndTag() throws JspException {
  
          String formatted = null;
  
          if (value == null) {
              if (var != null) {
                  pageContext.removeAttribute(var, scope);
              }
              return EVAL_PAGE;
          }
  
          // Create formatter
          Locale locale = SetLocaleSupport.getFormattingLocale(
                  pageContext,
                  this,
                  true,
                  DateFormat.getAvailableLocales());
  
          if (locale != null) {
              DateFormat formatter = createFormatter(locale, pattern);
  
              // Set time zone
              TimeZone tz = null;
              if ((timeZone instanceof String)
                      && ((String) timeZone).equals("")) {
                  timeZone = null;
              }
              if (timeZone != null) {
                  if (timeZone instanceof String) {
                      tz = TimeZone.getTimeZone((String) timeZone);
                  } else if (timeZone instanceof TimeZone) {
                      tz = (TimeZone) timeZone;
                  } else {
                      throw new JspTagException(
                              Resources.getMessage("FORMAT_DATE_BAD_TIMEZONE"));
                  }
              } else {
                  tz = TimeZoneSupport.getTimeZone(pageContext, this);
              }
              if (tz != null) {
                  formatter.setTimeZone(tz);
              }
              formatted = formatter.format(value);
          } else {
              // no formatting locale available, use Date.toString()
              formatted = value.toString();
          }
  
          if (var != null) {
              pageContext.setAttribute(var, formatted, scope);
          } else {
              try {
                  pageContext.getOut().print(formatted);
              } catch (IOException ioe) {
                  throw new JspTagException(ioe.toString(), ioe);
              }
          }
  
          return EVAL_PAGE;
      }
docs: /*
  Formats the given date and time.