code: public Date parse(String dateString)
  	throws ParseException
  	{
  		Date result = null;
  		ParseException lastException = null;
  		
  		for (DateFormat format : inputFormats)
  		{
  			try
  			{
  				result = ((DateFormat) format.clone()).parse(dateString);	// DateFormat is not thread safe.
  				lastException = null;
  				break;
  			}
  			catch (ParseException e)
  			{
  				// Keep the first exception that occurred.
  				if (lastException == null)
  				{
  					lastException = e;
  				}
  				// And just try the next input format.
  			}
  		}
  
  		if (lastException != null)
  		{
  			throw lastException;
  		}
  
  		return result;
  	}
docs: Attempts to parse the given string into a java.util.Date using the provided
  input formats.
  
  @param dateString a date string in one of the acceptable formats.
  @throws ParseException if the date is not in one of the input formats.