SyntaxFix
Write A Post
Hire A Developer
Questions
Use the timestamp you get by calling valueOf on the date object:
valueOf
var diff = date2.valueOf() - date1.valueOf(); var diffInHours = diff/1000/60/60; // Convert milliseconds to hours