Fix dates entered with format dd / MM / YYYY

1

With Java, instead of recording dates with the dd/MM/yyyy format in the database, I used the year in uppercase ( dd/MM/YYYY ). I would like to revert the engraving, and be able to transform the dates wrongly entered for the correct dates, but I have not found any form or pattern to achieve it. Could someone tell me the way to do it? Below you have a sample of what I did.

String FORMATO_FECHA = "dd/MM/YYYY";
String fechaStr = "14/06/2014";
System.out.println("FECHA ORIGINAL: " + fechaStr);
Date fechaDate = null;
try {

    DateFormat format = new SimpleDateFormat(FORMATO_FECHA);
    fechaDate = format.parse(fechaStr);

    System.out.println("FECHA TRANSFORMADA: " + fechaDate);//Esta es la fecha que he grabado en base de datos

} catch (Exception e) {

}
    
asked by rosendo09 20.04.2017 в 15:28
source

0 answers