javascript - How to get the hours difference between two date objects? -


this question has answer here:

i got 2 date objects , want calculate difference in hours.

if difference in hours less 18 hours, want push date object array.

javascript / jquery, doesn't matter; works best do.

the simplest way directly subtract date objects 1 another.

for example:

var hours = math.abs(date1 - date2) / 36e5; 

the subtraction returns difference between 2 dates in milliseconds. 36e5 scientific notation 60*60*1000, dividing converts milliseconds difference hours.


Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -