传入参数是标准格式的日期 如:2019-07-21 18:00:00
function getRemainderTime (startdate,enddate){
//console.log(“startdate is “+ startdate+”;enddate is “+ enddate);
var s1 = new Date(startdate);
var s2 = new Date(enddate);
runTime = parseInt((s2.getTime() - s1.getTime()) / 1000);
var year = Math.floor(runTime / 86400 / 365);
runTime = runTime % (86400 365);
var month = Math.floor(runTime / 86400 / 30);
runTime = runTime % (86400 30);
var day = Math.floor(runTime / 86400);
runTime = runTime % 86400;
var hour = Math.floor(runTime / 3600);
runTime = runTime % 3600;
var minute = Math.floor(runTime / 60);
runTime = runTime % 60;
var second = runTime;
console.log(year,month,day,hour,minute,second);
return year+’,’+month+’,’+day+’,’+hour+’,’+minute+’,’+second;
}