EjemplosDuoc.es.tl
  Fechas
 
 

Un metodo para validar una fecha capturada en un String
 

import java.text.SimpleDateFormat;
import java.util.Date;
import java.text.DateFormat;
import java.text.ParseException;

//metodo
private static boolean isFechaValida(String fechax) {
    boolean ret=true;
    try {
        SimpleDateFormat formatoFecha = new SimpleDateFormat("dd/MM/yyyy",
        Locale.getDefault());
        formatoFecha.setLenient(false);
        formatoFecha.parse(fechax);
    } catch (ParseException e) {
        ret=false;
    }
    return ret;
}


Aporte: Ignacio.lxc


 
   
 
Este sitio web fue creado de forma gratuita con PaginaWebGratis.es. ¿Quieres también tu sitio web propio?
Registrarse gratis