String format(Object obj,StringBuffer toAppendTo) throws IllegalArgumentException {
  Date source=null;
  if (obj instanceof Date) {
    source=(Date)obj;
  }
 else   if (obj instanceof String) {
    try {
      source=parse((String)obj);
    }
 catch (    ParseException pe) {
      throw new RuntimeException(pe.toString());
    }
  }
  if (source == null) {
    throw new IllegalArgumentException((obj == null) ? "null" : obj.toString());
  }
  return format(source,toAppendTo);
}

String format ( Object obj , StringBuffer toAppendTo ) throws IllegalArgumentException { Date source = null ; if ( obj instanceof Date ) { source = ( Date ) obj ; } else if ( obj instanceof String ) { try { source = parse ( ( String ) obj ) ; } catch ( ParseException pe ) { throw new RuntimeException ( pe . toString ( ) ) ; } } if ( source == null ) { throw new IllegalArgumentException ( ( obj == null ) ? "null" : obj . toString ( ) ) ; } return format ( source , toAppendTo ) ; }
format a given object .
