js时间时间戳倒计时天时分秒
getdate:function(){
var date = new Date();
var now = date.getTime();
var endTime = new Date(startSellTime);// 结束时间
var end = endTime.getTime();
var lefttime = end - now ;
var d,h,m,s;
if(lefttime > 0){
// d = Math.floor(lefttime / 1000 / 60 / 60 / 24)
h = Math.floor(Math.floor(lefttime / 1000 / 60 / 60 / 24)*24 + (lefttime / 1000 / 60 / 60 % 24))
m = Math.floor(lefttime / 1000 / 60 % 60 )
s = Math.floor(lefttime / 1000 % 60 )
if(s < 10){
s = '0' + s
}
if(m < 10){
m = '0' + m
}
if(h < 10){
h = '0' + h
}
}else{
// 清除定时器
clearTimeout(timer)
$('.datebtn').show()
$('.datebtnother').hide()
}
$('.datetest').html(h + '时' + m + '分' + s + '秒后开始')
var timer = setTimeout(() => {
_this.getdate()
}, 1000);
}