How to subtract hours from two columns of a jtable with mysql data

0

hi friends I hope you can help me! I need to subtract the hours of two columns of a table and show the result of the subtraction in another column of the table. I want to show the result in hours format, the data I bring from the database and they are of the time type, this is the code that I'm using to subtract:

    fechaInicio = new SimpleDateFormat("hh:mm:ss").parse((String) modelo.getValueAt(i, 5));
            Date fecFinal = new SimpleDateFormat("hh:mm:ss").parse((String) modelo.getValueAt(i, 7));
            long tiempoInicial = fechaInicio.getTime();
            long tiempoFinal = fecFinal.getTime();
            resta = tiempoFinal - tiempoInicial; 
            atrasose = resta/(1000* 60);           
            modelo.setValueAt( atrasose,i, 10);
    
asked by vero m. 30.07.2018 в 05:27
source

0 answers