public final StringBuffer 
        format(Object obj, StringBuffer appendTo, FieldPosition fieldPosition)
    {
        if ( obj instanceof DateInterval ) {
            return format( (DateInterval)obj, appendTo, fieldPosition);
        }
        else {
            throw new IllegalArgumentException("Cannot format given Object (" + obj.getClass().getName() + ") as a DateInterval");
        }
    }
public final StringBuffer format ( Object obj , StringBuffer appendTo , FieldPosition fieldPosition ) { if ( obj instanceof DateInterval ) { return format ( ( DateInterval ) obj , appendTo , fieldPosition ) ; } else { throw new IllegalArgumentException ( "Cannot format given Object (" + obj . getClass ( ) . getName ( ) + ") as a DateInterval" ) ; } }
Format an object to produce a string. This method handles Formattable
objects with a DateInterval type.
If a the Formattable object type is not a DateInterval,
IllegalArgumentException is thrown.

@param obj               The object to format.
Must be a DateInterval.
@param appendTo          Output parameter to receive result.
Result is appended to existing contents.
@param fieldPosition     On input: an alignment field, if desired.
On output: the offsets of the alignment field.
There may be multiple instances of a given field type
in an interval format; in this case the fieldPosition
offsets refer to the first instance.
@return                  Reference to 'appendTo' parameter.
@throws    IllegalArgumentException  if the formatted object is not
DateInterval object