JAVA: How to minus the currentime and the data time that has been stored in database.?

66 Views Asked by At

I'm developing a fingerprint based attendance system using Java and i don't know how to automatically logout after the 2nd time around of scanning the same fingerprint data. The question is how to minus the current time and the time that has been stored in the database.

here is my code

  String sqlReports ="SELECT 
  sch_id='"+id.getText()+"',name,date,timein,timeout FROM reports";
  Statement st = cn.createStatement();
  ResultSet rs = st.executeQuery(sqlReports);              
  while(rs.next()){
  SimpleDateFormat sdf = new SimpleDateFormat("hh:mm:ss a"); 
  out.setText(sdf.format(rs.getString("timeout")));
  String r= sdf.format(cal.getTime());

if (cal.getTime() - out.getText() > 10) {

//Updatesqlhere

        }`
0

There are 0 best solutions below