I'm filling a jtable with the birthdays that are registered in a database.
public void jTablePop()
{
javax.swing.table.DefaultTableModel dtm2 = (javax.swing.table.DefaultTableModel)jTable1.getModel();
dtm2.setNumRows(0);
//ISSO TIRA AS LINHAS DA TABELA
int x=0;
try{
conexao.Conectar();
conexao.sql = "select cli_nome,cli_cpf,cli_data_nascimento from contrato where id_cli > 1 ";
conexao.ps = conexao.con.prepareStatement(conexao.sql);
conexao.rs = conexao.ps.executeQuery();
while(conexao.rs.next())
{
//codigo
dtm2.addRow(new Object[]{" "," "," "});
jTable1.setValueAt(conexao.rs.getString(1),x,0);
jTable1.setValueAt(conexao.rs.getString(2),x,1);
jTable1.setValueAt(conexao.rs.getString(3),x,2);
x++;
}
}catch(SQLException ex){
JOptionPane.showMessageDialog(rootPane, ex.getMessage(), "ERRO!", JOptionPane.ERROR_MESSAGE);
}
}
But I need jTable to appear only the birthdays of the month, how could I do this? I have already put the date in a variable like this:
public void kappa()
{
SimpleDateFormat sdf1= new SimpleDateFormat("dd/MM/yyyy");
Date y=new Date();
String keppo = sdf1.format(y).toString();
}
How could I display jTable just the birthdays of the month? could you help me?