I\'ve got a bit of code here that calculates the hours difference between two datetimes. Kind of at a loss here. Code is hit or miss and I\'m not sure why.
var
date.js solves your problem:
var first = Date.parse(01/09/2011 10:30 am);
var second = Date.parse(01/11/2011 11:00 am);
var diffMs = Math.abs(first - second) // difference in milliseconds
The problem is that your parseInt() on date[1] is using the leading zero.
return new Date(
parseInt(date[2]), parseInt(date[0])-1, parseInt(date[1]),
hm[0], parseInt(hm[1])
);
When you pass a date like 01/09/2011, the 09 is being parsed as 0, not 9.