Created
December 10, 2015 21:01
-
-
Save akuafif/3e8981343c01cbfd6af8 to your computer and use it in GitHub Desktop.
[Java/Android] Date Validation from a String (eg. 32-13-2015 is not Valid)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// The Date Format | |
final static String DATE_FORMAT = "dd-MM-yyyy"; | |
public static boolean isDateValid(String inputDate) { | |
try { | |
DateFormat df = new SimpleDateFormat(DATE_FORMAT); | |
df.setLenient(false); | |
df.parse(inputDate); | |
return true; | |
} catch (ParseException e) { | |
return false; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment