Set Date on jDateChooser and retrieve record from database.
d5 = ((JTextField)jDateChooser1.getDateEditor().getUiComponent()).getText();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
Calendar c = Calendar.getInstance();
try {
c.setTime(sdf.parse(d5));
} catch (ParseException ex) {
Logger.getLogger(Commity.class.getName()).log(Level.SEVERE, null, ex);
}
c.add(Calendar.MONTH, 1); // number of days to add
d5 = sdf.format(c.getTime());
System.out.println(""+d5);
try {
java.util.Date date = new SimpleDateFormat("yyyy-MM-d").parse(String.valueOf(d5));
jDateChooser1.setDate(date);
} catch (ParseException ex) {
Logger.getLogger(Commity.class.getName()).log(Level.SEVERE, null, ex);
}
try
{
Class.forName("com.mysql.jdbc.Driver");
java.sql.Connection con=DriverManager.getConnection("jdbc:mysql://localhost:3305/commity","root","root");
String sql="select MemberName,Group_Number,Payment from insatllment where Date='"+d5+"'";
java.sql.PreparedStatement pst=con.prepareStatement(sql);
ResultSet rs = pst.executeQuery(sql);
countdate.setModel(DbUtils.resultSetToTableModel(rs));
con.close();
pst.close();
}
catch(Exception e)
{
JOptionPane.showMessageDialog(null, e);
}