I have a problem with types of date variables... I need to take date from database and compare it with current date... I think that I get date from database in right way, but I don't know how to take current date in same type of date variable to can compare it.. In my database format for saving data of date is "DATE" yyyy-mm-dd.
Date now = new Date();
Class.forName("com.mysql.jdbc.Driver");
Connection con=DriverManager.getConnection("jdbc:mysql://localhost:3306/database", "root", "");
Statement stmt = con.createStatement();
String sql="SELECT * FROM users WHERE username='"+textField_Username.getText()+"' AND password='"+textField_Password.getText().toString()+"'";
ResultSet rs=stmt.executeQuery(sql);
if(rs.next()) {
Date expire = new Date(rs.getDate("account_expire").getTime());
if(expire.before(now)){
}
dispose();
JOptionPane.showMessageDialog(null, "Login Sucessfully.");
Workshop window = new Workshop();
window.frmCfWorkshop.setVisible(true);
} else {
JOptionPane.showMessageDialog(null, "Incorrect username and password...");
}