8:00-8:10--------->0.5 8:00-8:30--------->0.5 8:00-8:35--------->1 8:00-9:00--------->1
日期参数格式为 ( 时:分)
function getTimes(sdate,edate){
var arr1=sdate.split(":"); //13 01
var arr2=edate.split(":");
var s1 = "1981/01/01 "+arr1[0]+":"+arr1[1]+":00";
var s2 = "1971/01/01 "+arr2[0]+":"+arr2[1]+":00";
var sdate = new Date(s1);//拼起始时间
var edate = new Date(s2); //拼结束时间
lsdate = sdate.getTime();//获取起始时间的毫秒数
ledate = edate.getTime();//获取结束时间的毫秒数
var cha = ledate - lsdate;
if(cha>0){
var fenzhong = (cha / 1000 / 60);
var xiaoshi = fenzhong / 60;
var zxiaoshi = Math.floor(xiaoshi);
var yushu = fenzhong % 60;
var result= zxiaoshi;
if(yushu > 30){
result= 1 + zxiaoshi;
}else if(yushu > 0 && yushu <= 30){
result= 0.5 + zxiaoshi;
}
}
}
}