js实现秒转换成天时分秒效果

代码语言:html

所属分类:其他

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>BFW NEW PAGE</title>

</head>
<body style="padding:50px;">

    <div>
        11111111秒=<span id="timeout1"></span>
    </div>
    <div>
        222秒=<span id="timeout2"></span>
    </div>
    <script type="text/javascript">

        function secondsFormat(s) {
            var day = Math.floor(s/ (24*3600)); // Math.floor()向下取整
            var hour = Math.floor((s - day*24*3600) / 3600);
            var minute = Math.floor((s - day*24*3600 - hour*3600) /60);
            var second = s - day*24*3600 - hour*3600 - minute*60;
            if (day > 0) {
                return .........完整代码请登录后点击上方下载按钮下载查看

网友评论0