Is there anyway to validate if a given date(yyyy-MM-dd) is a valid date? It should handle leap year too. eg(2015-02-29) should be invalid. I\'m retrieving the date as a stri
Use SimpleDateFormat
public boolean valiDate(String dateString){ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); sdf.setLenient(false); try { Date date = sdf.parse(dateString); return true; } catch (ParseException ex) { return false; } }