美文网首页
将时间戳转为时分秒倒计时

将时间戳转为时分秒倒计时

作者: 叶向晚77 | 来源:发表于2017-03-24 14:43 被阅读0次

countdown:function(_t) {

var_result = {

day:0,

hour:0,

minue:0,

sec:0

}

if(_t >0) {

_result.day=Math.floor(_t /1000/60/60/24) <10?'0'+Math.floor(_t /1000/60/60/24).toString() :Math.floor(_t /1000/60/60/24).toString();

_result.hour=Math.floor(_t /1000/60/60%24) <10?'0'+Math.floor(_t /1000/60/60%24).toString() :Math.floor(_t /1000/60/60%24).toString();

_result.minue=Math.floor(_t /1000/60%60) <10?'0'+Math.floor(_t /1000/60%60).toString() :Math.floor(_t /1000/60%60).toString();

_result.sec=Math.floor(_t /1000%60) <10?'0'+Math.floor(_t /1000%60).toString() :Math.floor(_t /1000%60).toString();

}

return_result;

},

相关文章

网友评论

      本文标题:将时间戳转为时分秒倒计时

      本文链接:https://www.haomeiwen.com/subject/mokfottx.html