这个可以,你试下
var begindate = '2010-2-15';
var enddate = '2010-3-25';
function getDateDiff(date1,date2){
var arr1=date1.split('-');
var arr2=date2.split('-');
var d1=new Date(arr1[0],arr1[1],arr1[2]);
var d2=new Date(arr2[0],arr2[1],arr2[2]);
alert((d2.getTime()-d1.getTime())/(1000*3600*24));
}
getDateDiff(begindate,enddate);