• 时间数字(单位/秒)转换为 时间格式(00:00:00)


    Javascript 版本

         function showTime(iTimelLength) {
                var str = "";
                var s = parseInt(iTimelLength % 60);
                var m = parseInt(((iTimelLength - s) / 60) % 60);
                var h = parseInt((iTimelLength - s) / 3600);
                str += (h >= 10 ? h + ":" : h > 0 ? "0" + h + ":" : "00:");
                str += (m >= 10 ? m + ":" : m > 0 ? "0" + m + ":" : "00:");
                str += (s >= 10 ? s : s > 0 ? "0" + s : "00");
                $("#txtTimeLength").val(str);  //输出格式:00:00:00
            }

    C# 版本

    decimal iTimelLength = model.videoTimeLength;
    var str = "";
    decimal s = Convert.ToDecimal(iTimelLength % 60);
    int m = Convert.ToInt32(((iTimelLength - s) / 60) % 60);
    int h = Convert.ToInt32((iTimelLength - s) / 3600);
    str += (h >= 10 ? h.ToString() + ":" : h > 0 ? "0" + h.ToString() + ":" : "00:");
    str += (m >= 10 ? m.ToString() + ":" : m > 0 ? "0" + m.ToString() + ":" : "00:");
    str += (s >= 10 ? s.ToString() : s > 0 ? "0" + s.ToString() : "00");
    this.txtTimeLength.Text = str;  //输出格式:00:00:00
  • 相关阅读:
    20200304(10)
    20200303Tuesday(9)
    词根词缀explicit(8)
    词根词缀(7)
    20200303(6)
    什么是ring0-ring3
    20200301a
    mark字体大全
    评估评价 提高专项(5)
    图的广度优先遍历算法
  • 原文地址:https://www.cnblogs.com/jronny/p/12090311.html
Copyright © 2020-2023  润新知