public static String selectDateFormat(Locale locale, String format) {
		String selFormat;
		if (format == null) {
			selFormat = ((SimpleDateFormat) DateFormat.getDateInstance(DateFormat.SHORT, locale)).toPattern();
			// Since DateFormat.SHORT is silly, return a smart format
			if (selFormat.equals("M/d/yy")) {
				return "MM/dd/yyyy";
			}
			if (selFormat.equals("d/M/yy")) {
				return "dd/MM/yyyy";
			}
		} else {
			selFormat = format;
		}

		return selFormat;
	}
public static String selectDateFormat ( Locale locale , String format ) { String selFormat ; if ( format == null ) { selFormat = ( ( SimpleDateFormat ) DateFormat . getDateInstance ( DateFormat . SHORT , locale ) ) . toPattern ( ) ; if ( selFormat . equals ( "M/d/yy" ) ) { return "MM/dd/yyyy" ; } if ( selFormat . equals ( "d/M/yy" ) ) { return "dd/MM/yyyy" ; } } else { selFormat = format ; } return selFormat ; }
Selects the Date Pattern to use based on the given Locale if the input
format is null

@param locale
Locale (may be the result of a call to selectLocale)
@param format
Input format String
@return Date Pattern eg. dd/MM/yyyy