code: public int doEndTag() throws JspException {
          if (value == null) {
              if (var != null) {
                  pageContext.removeAttribute(var, scope);
              }
              return EVAL_PAGE;
          }
  
          // Create formatter
          DateTimeFormatter formatter;
          if (pattern != null) {
              formatter = DateTimeFormat.forPattern(pattern);
          } else if (style != null) {
              formatter = DateTimeFormat.forStyle(style);
          } else {
              // use a medium date (no time) style by default; same as jstl
              formatter = DateTimeFormat.mediumDate();
          }
  
          // set formatter locale
          Locale locale = this.locale;
          if (locale == null) {
              locale = Util.getFormattingLocale(pageContext, this, true,
                      DateFormat.getAvailableLocales());
          }
          if (locale != null) {
              formatter = formatter.withLocale(locale);
          }
  
          // set formatter timezone
          DateTimeZone tz = this.dateTimeZone;
          if (tz == null) {
              tz = DateTimeZoneSupport.getDateTimeZone(pageContext, this);
          }
          if (tz != null) {
              formatter = formatter.withZone(tz);
          }
  
          // format value
          String formatted;
          if (value instanceof ReadableInstant) {
              formatted = formatter.print((ReadableInstant) value);
          } else if (value instanceof ReadablePartial) {
              formatted = formatter.print((ReadablePartial) value);
          } else {
              throw new JspException(
                  "value attribute of format tag must be a ReadableInstant or ReadablePartial," +
                  " was: " + value.getClass().getName()); 
          }
  
          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 instant or partial.