i am having problems calculating time for my mini Computer Based Training project.The system should calculate and monitortime spent by a trainee (2 hrs)on a pc and subtract it from the duration of the course (e.g 20hrs ) until the course is complete.The facilitator logs a trainee on the server and that should start the timer.
so i have my forms (GUI), a class called DataServices(containing methods and SQL statements to access database),and mySQL database.snipetts of my code;
LOGIC: endTime = startTime + 2hrs
span = endTime - startTime
if currentTime = endTime Or
currentTime - startTime = span then sessionEnded()
public class DataService {
private Date time = new Date();
private DateFormat dateFormat = DateFormat.getDateInstance(DateFormat.SHORT);
how do you add or subtract time?how do you make your textfields accept/display time.how do you get current time at certain intervals?hrs/mins?
i came across something like:
startTime = System.currentTimeMillis();
endTime = System.currentTimeMillis();
how and where do i declare and use these; or maybe i need a stopwatch?please help , i am not a good programmer.
so i have my forms (GUI), a class called DataServices(containing methods and SQL statements to access database),and mySQL database.snipetts of my code;
LOGIC: endTime = startTime + 2hrs
span = endTime - startTime
if currentTime = endTime Or
currentTime - startTime = span then sessionEnded()
public class DataService {
private Date time = new Date();
private DateFormat dateFormat = DateFormat.getDateInstance(DateFormat.SHORT);
how do you add or subtract time?how do you make your textfields accept/display time.how do you get current time at certain intervals?hrs/mins?
i came across something like:
startTime = System.currentTimeMillis();
endTime = System.currentTimeMillis();
how and where do i declare and use these; or maybe i need a stopwatch?please help , i am not a good programmer.