Hi, Please help me in getting the difference between the two timestamps. Var d = new Date() Var timestamp1 = d.getTime() Var timestamp2 = d.getTime() Var timediff = timestamp2 – timestamp1 Alert(timediff) When I execute this code, I get a NaN What’s going wrong with this code? Kindly help me with this problem. Thanks, Dhina
You should use parenthesis and var is lowercase. Try this, is working for me: var d = new Date(); var timestamp1 = d.getTime() var timestamp2 = d.getTime(); var timediff = timestamp2 - timestamp1; alert(timediff); Code (markup):