You can use Date
s in javascript.
To get the now
-Date you simply do Date.now()
. To get the date from a specific time you can look into the wonderful MDN docs which says:
new Date(year, monthIndex [, day [, hour [, minutes [, seconds [, milliseconds]]]]]);
Now you can simply substract both dates and what you get are the difference in milliseconds:
Date.now() - new Date(1980, 1, 20) // 20th february 1980
2
solved calculate the difference between two times js/jquery