根据两个时间差计算相差小时数
根据两个时间差计算相差小时数
function getHtime(date1,date2){var startDate= new Date(date1.replace(/-/g,"/")); var endDate= new Date(date2.replace(/-/g,"/")); var df=(endDate.getTime()-startDate.getTime());df = df/60/60/1000;var theTimeH = df;if(df.toString().indexOf('.') > 0){var dl = df.toString().indexOf('.');var splitH = df.toString().substring(dl+1,dl+2);if(splitH >= 9){df +=1;}theTimeH = df.toString().substring(0,dl);}return theTimeH;}