I want to get the difference between two dates in days, hours and minutes. I tried to do this using the ms from January 1st 1970 like this:
var d = new Date()
daydiff = ~~((d.getTime()-(Date.parse(SavedReminders[i][7]))) / 86400000);
hourdiff = ~~((d.getTime() - (Date.parse(SavedReminders[i][7]))) / 3600000);
mindiff = ~~((d.getTime() - (Date.parse(SavedReminders[i][7]))) / 60000);
where SavedReminders[i][7] = 2015-04-06T17:34:00
However this gives some weird results, if i test it in the same hour (5pm) then it seems to work, but when it becomes 6pm or 7pm i start getting incorrect results, as if it's not taking account of hours.
For example when the current time is '2015-04-06T19:26:00' and i run this code it gives the results:
d.getTime() = 1428344775364
Date.parse(SavedReminders[i][7] = 1428341640000
daydiff = 0
hourdiff = 0
mindiff = 52