Is there a way whereby the date format can be determined in Java similar to .Net?
Consider the following example:
private String reformatDateString(String dateParam){
    if(dateParam == null || dateParam.isEmpty()){
        return null;
    }
    try{
        SimpleDateFormat inDateFormat = new SimpleDateFormat("yyyy-MM-dd");
        Date fromDate = inDateFormat.parse(dateParam);
        SimpleDateFormat outDateForm = new SimpleDateFormat("yy-MM-dd");
        return outDateForm.format(fromDate);
    } catch(ParseException e){
        e.printStackTrace();
        return null;
    }
}
Is there an easier way for the parser to know the inDateFormat instead of strictly providing the two formats?