Javascript Date DiffInDays(date)
Date.prototype.DiffInDays = function (date) { if(date instanceof Date && !isNaN(date.getTime())) { var cDate = this.getTime(); var tDate = date.getTime(); var resultMillis = Math.abs(cDate - tDate); var result = resultMillis / 1000 / 60 / 60 / 24; return result;/*w ww .java2s . c o m*/ } else { console.error(date, " is not a valid date.") } }