Created
April 9, 2021 19:23
-
-
Save userddssilva/6815c027f138b24479dce65166e0c3be to your computer and use it in GitHub Desktop.
This file contains hidden or 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
// Configure o SimpleDateFormat no onCreate ou onCreateView | |
String pattern = "dd/MM/yyyy"; | |
SimpleDateFormat sdf = new SimpleDateFormat(pattern); | |
sdf.setLenient(false); | |
// Durante a confirmacao de cadastro, faça a validacao | |
String data = NascimentoUsu.getText().toString(); | |
try { | |
Date date = sdf.parse(data); | |
// Data formatada corretamente | |
} catch (ParseException e) { | |
// Erro de parsing!! | |
e.printStackTrace(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment