TimeDown (t) {
t= t.replace(/\-/g,"/");
var now = new Date();
var endDate = new Date(t);
var n=(endDate.getTime()-now.getTime())/1000;
var days=0,
hours=0,
minutes=0,
seconds=0;
if(n>=0){
days = Math.floor(n / 3600 /24);
hours = Math.floor(n / 3600 % 24);
minutes = Math.floor(n / 60 % 60);
seconds = Math.floor(n % 60);
}
if(days <= 9) days ='0'+days;
if(hours <= 9) hours ='0'+hours;
if(minutes <= 9) minutes ='0'+minutes;
if(seconds <= 9) seconds = '0'+seconds;
var resultTime =[days,hours,minutes,seconds];
this.resultTime =resultTime;
},
网友评论