首页 > 网站 > WEB开发 > 正文

JS将秒转换为 天-时-分-秒

2024-04-27 15:13:54
字体:
来源:转载
供稿:网友
function SecondToDate(msd) {            var time =msd            if (null != time && "" != time) {                if (time > 60 && time < 60 * 60) {                    time = parseInt(time / 60.0) + "分钟" + parseInt((parseFloat(time / 60.0) -                        parseInt(time / 60.0)) * 60) + "秒";                }                else if (time >= 60 * 60 && time < 60 * 60 * 24) {                    time = parseInt(time / 3600.0) + "小时" + parseInt((parseFloat(time / 3600.0) -                        parseInt(time / 3600.0)) * 60) + "分钟" +                        parseInt((parseFloat((parseFloat(time / 3600.0) - parseInt(time / 3600.0)) * 60) -                        parseInt((parseFloat(time / 3600.0) - parseInt(time / 3600.0)) * 60)) * 60) + "秒";                else if (time >= 60 * 60 * 24) {                    time = parseInt(time / 3600.0/24) + "天" +parseInt((parseFloat(time / 3600.0/24)-                        parseInt(time / 3600.0/24))*24) + "小时" + parseInt((parseFloat(time / 3600.0) -                        parseInt(time / 3600.0)) * 60) + "分钟" +                        parseInt((parseFloat((parseFloat(time / 3600.0) - parseInt(time / 3600.0)) * 60) -                        parseInt((parseFloat(time / 3600.0) - parseInt(time / 3600.0)) * 60)) * 60) + "秒";                }                else {                    time = parseInt(time) + "秒";                }            }            return time;        }
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表