I am attempting to create a simple time difference calculation by subtracting the end time from the start time. However, I am noticing that I am getting an extra hour in my result. I believe this may be due to my timezone being GMT+1.
Regardless of the timezone issue, the time difference should remain accurate as both start and end times are in the same time zone.
You can view my code example in action here:
http://jsfiddle.net/kaze72/Rm3f3/
$(document).ready(function() {
var startTime = (new Date).getTime();
$("#endTime").click(function() {
var endTime = (new Date).getTime();
var difference = new Date(endTime - startTime);
console.log(difference.getUTCHours() + ":" +
difference.getUTCMinutes() + ":" +
difference.getUTCSeconds());
console.log(difference.toLocaleTimeString());
});
})