Need help with calculating the time the user...
Hi, I please need help to calculate the time the user used my program for.
I'm not sure if my code is correct, I used 'System.currentTimeMillis();'
Here is my code for calculating the programRuntime:
Code:
SimpleDateFormat format2 = new SimpleDateFormat("hh:mm:ss a");
static long timeIn = new Date().getTime();
public static long programRuntime() {
long timeInD = timeIn;
long timeOutD = System.currentTimeMillis();
long msec = timeOutD - timeInD;
return msec;
}
I don't think I've used 'System.currentTimeMillis();' correctly.
Can anyone please help me with this.
If there is another way please tell me.
Thanks
Need help with calculating the time the user...
I just want to know if I've used the 'System.currentTimeMillis();' method correctly? Because I get a funny answer. e.g. "you have used the program for 7375 "
Is this answer 7.3 seconds ??
If so how can I get it in 'hh:mm:ss'?
Thank you