I have written below function which calculate date difference in days
function dateDiff (date2, date1) {
var days = 0;
if (date2 != null && date1 != null) {
date1 = new Date(date1).getTime();
date2 = new Date(date2).getTime();
var timediff = date2 - date1;
if (!isNaN(timediff)) {
//day 86400000 = second = 1000,minute = second * 60,hour = minute * 60,day = hour * 24, to get day
days = Math.floor(timediff / 86400000);
}
}
return days > 0 ? days : 0;
};
then i have called this function with following parameter
dateDiff (new Date,'2013-09-17T00:00:00') //return 1 days
dateDiff (new Date,'2013-09-17T17:31:57.75' ) //return 0 days
value of new Date() = 'Wed Sep 18 2013 18:50:01 GMT+0530 (India Standard Time)'
this function work fine in firefox but not work in chrome? i am not getting why this function return different result in different browser?