public static Date parseDate(String dateValue,Collection dateFormats,Date startDate) throws DateParseException {
  if (dateValue == null) {
    throw new IllegalArgumentException("dateValue is null");
  }
  if (dateFormats == null) {
    dateFormats=DEFAULT_PATTERNS;
  }
  if (startDate == null) {
    startDate=DEFAULT_TWO_DIGIT_YEAR_START;
  }
  if (dateValue.length() > 1 && dateValue.startsWith("'") && dateValue.endsWith("'")) {
    dateValue=dateValue.substring(1,dateValue.length() - 1);
  }
  SimpleDateFormat dateParser=null;
  final Iterator formatIter=dateFormats.iterator();
  while (formatIter.hasNext()) {
    final String format=(String)formatIter.next();
    if (dateParser == null) {
      dateParser=new SimpleDateFormat(format,Locale.US);
      dateParser.setTimeZone(TimeZone.getTimeZone("GMT"));
      dateParser.set2DigitYearStart(startDate);
    }
 else {
      dateParser.applyPattern(format);
    }
    try {
      return dateParser.parse(dateValue);
    }
 catch (    final ParseException pe) {
    }
  }
  throw new DateParseException("Unable to parse the date " + dateValue);
}

public static Date parseDate ( String dateValue , Collection dateFormats , Date startDate ) throws DateParseException { if ( dateValue == null ) { throw new IllegalArgumentException ( "dateValue is null" ) ; } if ( dateFormats == null ) { dateFormats = DEFAULT_PATTERNS ; } if ( startDate == null ) { startDate = DEFAULT_TWO_DIGIT_YEAR_START ; } if ( dateValue . length ( ) > 1 && dateValue . startsWith ( "'" ) && dateValue . endsWith ( "'" ) ) { dateValue = dateValue . substring ( 1 , dateValue . length ( ) - 1 ) ; } SimpleDateFormat dateParser = null ; final Iterator formatIter = dateFormats . iterator ( ) ; while ( formatIter . hasNext ( ) ) { final String format = ( String ) formatIter . next ( ) ; if ( dateParser == null ) { dateParser = new SimpleDateFormat ( format , Locale . US ) ; dateParser . setTimeZone ( TimeZone . getTimeZone ( "GMT" ) ) ; dateParser . set2DigitYearStart ( startDate ) ; } else { dateParser . applyPattern ( format ) ; } try { return dateParser . parse ( dateValue ) ; } catch ( final ParseException pe ) { } } throw new DateParseException ( "Unable to parse the date " + dateValue ) ; }
parses the date value using the given date formats .
