I'm new in java an having some trouble in calling of another a function from a class login which records a session user getting the date and time of login.. I would wish to call this function in a sales class where the users name will be retrieved from database table session
public void Sessiontracker(){
int day, month, year;
int second, minute, hour;
GregorianCalendar date = new GregorianCalendar();
day = date.get(Calendar.DAY_OF_MONTH);
month = date.get(Calendar.MONTH);
year = date.get(Calendar.YEAR);
second = date.get(Calendar.SECOND);
minute = date.get(Calendar.MINUTE);
hour = date.get(Calendar.HOUR);
String TheDate = +day+"/"+(month+1)+"/"+year;
String TheTime =+hour+" : "+minute+" : "+second;
try{
String sql2= "insert into session(Date,Time,Username)values('"+TheDate+"','"+TheTime+"','"+jTextField1.getText()+"' ) ";
pst=con.prepareStatement(sql2);
pst.execute();
}catch(SQLException | HeadlessException e){
JOptionPane.showMessageDialog(null, e);
}
}
that is the login class extract
private void Sessionuser (){
}
I would wish to call the function here