boolean checkFormate(string parm){ Pattern pattern = Pattern.compile("([0-9]{4})(0[1-9]|1[0-2])(0[1-9]|1[0-2][0-9]|3[0-1])"); Matcher matcher = Pattern.matcher(parm); if(matcher.matches()){ int y = interger.parseInt(matcher.group(1)); int m = interger.parseInt(matcher.group(2)); int d = interger.parseInt(matcher.group(3)); if(d > 28){ Calender c = Calender.getInstance(); c.set(y, m-1, 1); int lastDay = c.getActualMaximum(Calender.DAY_OF_LUOWTH); return lastDay>=d; }else{ return true; } } return false; }