I want to find the difference between the two dates. I tried this code, but it gives me the wrong values. I want to get total minutes between two dates, so I convert hours to minutes and add to minutes.
var hourDiff = timeEnd - timeStart; var diffHrs = Math.round((hourDiff % 86400000) / 3600000); var diffMins = Math.round(((hourDiff % 86400000) % 3600000) / 60000); diffMins = diffMins + (diffHrs * 60);
Here timeEnd is Mon Jan 01 2007 11:30:00 GMT+0530 (India Standard Time) ,
and timeStart - Mon Jan 01 2007 11:00:00 GMT+0530 (India Standard Time) .
Here, if the difference in hours I get 1 , it should be 0 and the minutes I get 30 , that's right. But the clock must be 0 . Am I something wrong here?
source share