I'm using the following piece of code:
$.log('Ending time: ' + ending_time);
$.log('Now: ' + new Date());
$.log('Difference: ' + new Date(ending_time - new Date()));
The output is the following:
Ending time: Thu Apr 23 2009 14:31:29 GMT+0200
Now: Thu Apr 23 2009 11:56:02 GMT+0200
Difference: Thu Jan 01 1970 03:35:26 GMT+0100
I'm using the "difference" to display how many hours and minutes there are left until ending_time
, but because of the timezone differences, I get the wrong time (offset by one hour.) So is there any neat way of calculating the difference taking timezones into account?