Java - Cambiar formato Fecha Jtable y sql server

 
Vista:
sin imagen de perfil
Val: 12
Ha aumentado su posición en 6 puestos en Java (en relación al último mes)
Gráfica de Java

Cambiar formato Fecha Jtable y sql server

Publicado por Francisco (5 intervenciones) el 22/02/2021 02:24:32
Hola, tengo una jtable que recibe datos de sql, tengo el problema que no puedo cambiar el formato de fecha a dd/mm/yyyy. De agradecería su colaboración.
Captura-de-pantalla-1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
private void LLenarTabla(){
         DefaultTableModel modelo = (DefaultTableModel) jTable1.getModel();
        modelo.setRowCount(0);
 
        try {
                String AsientoSeleccionado = jComboBox_Asiento.getSelectedItem().toString();
 
            try (Connection cn = DriverManager.getConnection(connectionUrl)) {
                PreparedStatement pst = cn.prepareStatement(
                "select id,libro.fecha,libro.cuenta,clasificacion,debe,haber from libro\n" +
"inner join asiento\n" +
"on asiento.id_asiento = libro.id_asiento \n" +
"inner join cuentas\n" +
"on libro.id_cuentas = cuentas.id_cuentas"
                        + " where libro.id_usuario = '" +id + "' and (asiento.Nombre='" + AsientoSeleccionado + "')");
 
 
 
                ResultSet rs = pst.executeQuery();
            while (rs.next())
            {
 
 
                Object [] fila = new Object[6];
 
 
                for (int i=0;i<6;i++)
                fila[i] = rs.getObject(i+1);
                modelo.addRow(fila);
 
            }
             }
        } catch (SQLException ex) {
 
        }
 
}
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder