prototype,怎么计算两个日期相差的天数?

foollb 2011-01-23
prototype,怎么计算两个日期相差的天数?
blanky01 2011-03-01
Date.prototype.getDistanceDay=function(dateObj){
    var day=1000*60*60*24;
    return parseInt((this.getTime()-dateObj.getTime())/day);
}
var data1=new Date(1980,10,21,12,0,0);
var data2=new Date(1981,10,21,12,0,0);
alert(data1.getDistanceDay(data2));

/*我自己写的,嘿嘿菜鸟一个,盼更好的方法*/
Global site tag (gtag.js) - Google Analytics