I need to display to the table all the records who has is created_at this month. the format is mmm dd yyyy, Using java and sqlite
I have the column "Start" in my database, if the month of the date is this month, it has to appear in the table.
I Tried this code below,, pls guide me.
i need to select all the records, within the month.
try {
SimpleDateFormat dateFormat = new SimpleDateFormat("MM/dd/yyyy");
Calendar c = Calendar.getInstance();
c.set(Calendar.DAY_OF_MONTH, 1);
c = Calendar.getInstance(); // reset
String today = dateFormat.format(c.getTime());
int month = c.get(Calendar.MONTH) + 1;
String sql = "SELECT Firstname FROM Members_Tbl WHERE End = '" + month
+ "'";
pst = con.prepareStatement(sql);
rs = pst.executeQuery();
monthlyreports.setModel(DbUtils.resultSetToTableModel(rs));
rs.close();
} catch (Exception e) {
JOptionPane.showMessageDialog(null, e);
}