i've looking around how to do this and i found a lot of examples with complicated code. Im using this:
var time1 = new Date();
var time1ms= time1.getTime(time1); //i get the time in ms
then i do this in other part of the code
var time2 = new Date();
var time2ms= time2.getTime(time2);
and finnally:
var difference= time2ms-time1ms;
var lapse=new Date(difference);
label.text(lapse.getHours()+':'+lapse.getMinutes()+':'+lapse.getSeconds());
This works great, except for one issue, the hours it gaves me are always +1 so i have to add to the code (time.getHours()-1) otherwise it gaves me one hour more....
I think is an easier way to do it than all the other examples around... but i still dont understand why i need to add '-1' in order to have the correct lapse.
THanks!!!