Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
// 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