print : format de la date
Bonjour a tous,
Lorsque je demande unsystem.out.print d'une date issue d'une query celle-ci s'affiche sous le format "2017-02-03 22:32:25.000000 " alors que je voudrais un affichage 03-02-2017".
J'ai deja essaye des sfd, locale.date mais je n'arrive a aucun resultat. De plus je ne sais pas bien ou mettre la conversion de la date et où ecrire le code pour l'afficher.
Merci de bien vouloir m'aider
Habiler
Code:
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 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
| private void jTxtMatrFocusLost(){
PreparedStatement ps1,ps2;
Connection conn = Connect.ConnectDB();
try {
String SQL1 = "SELECT * FROM Signaletique where Matricule = ?";
ps1 = conn.prepareStatement(SQL1);
ps1.setString(1,jTxtMatr.getText());
ResultSet rs1 = ps1.executeQuery();
String SQL2 = "SELECT * FROM Decisions where Matr = ?";
ps2 = conn.prepareStatement(SQL2);
ps2.setString(1,jTxtMatr.getText());
ResultSet rs2 = ps2.executeQuery();
affiche("Matr Sql2:"+jTxtMatr.getText()) ;
affiche("Matr Sql2:"+jTxtMatr.getText()) ;
while ( rs1.next()) {
jTxtNomPrenom.setText(rs1.getString(3)+ " " + rs1.getString(4));
jTxtMatr2.setText(rs1.getString(3)+ " - " + rs1.getString(4));
while ( rs2.next()) {
textArea2.append((rs2.getString(2)+"=>"+
rs2.getString(3)+" - "+
rs2.getString(4)+" - "+
rs2.getString(5)+" - "+
rs2.getString(6)+ "\n"));
System.out.print("Last Name :"+rs1.getString(3) );
System.out.print( rs1.getString(4) );
System.out.print(" => "+rs2.getString(2));
System.out.print(" - "+rs2.getString(3));
System.out.println(" ");
ps.close();
}
}
}catch(SQLException e){
JOptionPane.showMessageDialog(null, e);
}
} |