src/org/kocakosm/pitaya/time/Dates.java
public static Date parse(String date, Locale locale, String... formats)
	{
		Parameters.checkNotNull(date);
		Parameters.checkCondition(formats.length > 0);
		for (String format : formats) {
			DateFormat df = new SimpleDateFormat(format, locale);
			df.setLenient(true);
			ParsePosition position = new ParsePosition(0);
			Date d = df.parse(date, position);
			if (d != null && position.getIndex() == date.length()) {
				return d;
			}
		}
		throw new IllegalArgumentException("Unparseable date: " + date);
	}
public static Date parse(String date, Locale locale, String... formats)
	{
		Parameters.checkNotNull(date);
		Parameters.checkCondition(formats.length > 0);
		for (String format : formats) {
			DateFormat df = new SimpleDateFormat(format, locale);
			df.setLenient(true);
			ParsePosition position = new ParsePosition(0);
			Date d = df.parse(date, position);
			if (d != null && position.getIndex() == date.length()) {
				return d;
			}
		}
		throw new IllegalArgumentException("Unparseable date: " + date);
	}
public static Date parse ( String date , Locale locale , String ... formats ) { Parameters . checkNotNull ( date ) ; Parameters . checkCondition ( formats . length > 0 ) ; for ( String format : formats ) { DateFormat df = new SimpleDateFormat ( format , locale ) ; df . setLenient ( true ) ; ParsePosition position = new ParsePosition ( 0 ) ; Date d = df . parse ( date , position ) ; if ( d != null && position . getIndex ( ) == date . length ( ) ) { return d ; } } throw new IllegalArgumentException ( "Unparseable date: " + date ) ; }
Parses a {@code String} representing a date into a {@code Date}
instance. The given formats will be used sequentially until a
successful parsing is obtained. A parsing is considered successful
if it parses the whole input {@code String}.

@param date the {@code String} to parse.
@param locale the {@code Locale} to use.
@param formats the date format patterns to use.

@return the parsed {@code Date}.

@throws NullPointerException if one of the arguments is {@code null}
or if {@code formats} contains a {@code null} reference.
@throws IllegalArgumentException if {@code formats} is empty or if
{@code date} can't be parsed with any of the specified formats.
Parses a { @code String } representing a date into a { @code Date } instance . The given formats will be used sequentially until a successful parsing is obtained . A parsing is considered successful if it parses the whole input { @code String } .