首页 > 其他 > 详细

把秒转换成小时:分:秒

时间:2018-09-28 15:41:04      阅读:119      评论:0      收藏:0      [点我收藏+]

showTime : function(t){
if(typeof t != ‘number‘)return "00:00:00";
var t = t .toString().charAt() == ‘-‘ ? t .toString().slice(1) : t;
h = t>=3600 ? Math.floor(t/3600) : 0,
m = (t - h * 60) >60 ? Math.floor((t - h * 3600)/60) : 0,
s = t - h * 3600 - m*60;
return (h ===0 ? "00" : (h<10?("0"+h):h)) +":"+(m === 0 ? "00" : (m<10?("0"+m):m))+":"+ (s === 0 ? "00" : (s<10?("0"+s):s)) ;
}

把秒转换成小时:分:秒

原文:https://www.cnblogs.com/carry-gan/p/9718923.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!