我希望能够从访问表的列中选择日期,并将该日期与今天的日期进行比较,但是我不断收到某种错误,告诉我格式存在问题或内部错误
LocalDateTime ldt = LocalDateTime.now().plusDays(1);
DateTimeFormatter formmat1 = DateTimeFormatter.ofPattern("dd-MM-yyyy HH:mm:ss");
JButton btnLoadTable = new JButton("Load Table");
btnLoadTable.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
try {
Connection conn=DriverManager.getConnection("jdbc:ucanaccess://E:\\testing.accdb");
String sql="SELECT Description,Name,Due_Date FROM Homework where Due_Date = '"+formmat1+"' ";
PreparedStatement pst=conn.prepareStatement(sql);
ResultSet rs=pst.executeQuery();
table.setModel(DbUtils.resultSetToTableModel(rs));
} catch (Exception e) {
e.printStackTrace();
}
}
});
btnLoadTable.setBounds(534, 96, 141, 23);
frame.getContentPane().add(btnLoadTable);