var OneMonth = start.substring(5,start.lastIndexOf ('-'));
var OneDay = start.substring(start.length,start.lastIndexOf ('-')+1);
var OneYear = start.substring(0,start.indexOf ('-'));
var TwoMonth = end.substring(5,end.lastIndexOf ('-'));
var TwoDay = end.substring(end.length,end.lastIndexOf ('-')+1);
var TwoYear = end.substring(0,end.indexOf ('-'));
var cha=((Date.parse(OneMonth+'/'+OneDay+'/'+OneYear)- Date.parse(TwoMonth+'/'+TwoDay+'/'+TwoYear))/86400000);
alert(cha);
var date1=new Date("2008/7/29");
var date2=new Date();
var nDiff=date2-date1;
var nHour,nMini,nSecond;
nHour=parseInt(nDiff/3600000);
nMini=parseInt((nDiff%3600000)/60000);
alert("今天距离昨天零点:\n"
+nHour+":小时\n"
+nMini+":分钟");
http://blog.csdn.net/xuStanly/article/details/2186411