标签:ring txt pre VID time 数字 func string val
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
标签:ring txt pre VID time 数字 func string val
原文地址:https://www.cnblogs.com/jronny/p/12090311.html