I am building a quiz and i need to calculate the total time taken to do the quiz. and i need to display the time taken in HH::MM::SS..any pointers?
+2
A:
new Date().time returns the time in milliseconds.
var nStart:Number = new Date().time;
// Some time passes
var nMillisElapsed:Number = new Date().time - nStart;
var strTime:String = Math.floor(nMillisElapsed / (1000 * 60 * 60)) + "::" +
(Math.floor(nMillisElapsed / (1000 * 60)) % 60) + "::" +
(Math.floor(nMillisElapsed / (1000)) % 60);
Brian
2008-09-18 16:54:53
do you take in account date in this example, what if somebody starts the quiz 1 minute before midnight ?
Omu
2009-11-01 19:51:01