src/main/java/pw/phylame/util/DateUtils.java
/**
     * Parses date from text with specified format.
     * @param text date string
     * @param format the format
     * @param def if date string is invalid return {@code def}
     * @return the Date or {@code def}
     */
Parses date from text with specified format.
@param text date string
@param format the format
@param def if date string is invalid return  def
@return the Date or  def
Parses date from text with specified format . @param text date string @param format the format @param def if date string is invalid return def @return the Date or def
public static Date parseDate(String text, String format, Date def) {
        SimpleDateFormat sdf = new SimpleDateFormat(format);
        try {
            return sdf.parse(text);
        } catch (ParseException e) {
            return def;
        }
    }
public static Date parseDate ( String text , String format , Date def ) { SimpleDateFormat sdf = new SimpleDateFormat ( format ) ; try { return sdf . parse ( text ) ; } catch ( ParseException e ) { return def ; } }
Parses date from text with specified format.
Parses date from text with specified format .