将秒转换成“天 时:分:秒“格式(vb实现)

前端之家收集整理的这篇文章主要介绍了将秒转换成“天 时:分:秒“格式(vb实现)前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

' 将秒转换成“天 时:分:秒“格式 Private Function Duration(ByVal ss As Long) As String Dim mi As Long: mi = 60 Dim hh As Long: hh = mi * 60 Dim dd As Long: dd = hh * 24 Dim day As Long: day = ss / dd Dim hour_ As Long: hour_ = (ss - day * dd) / hh Dim minute_ As Long: minute_ = (ss - day * dd - hour_ * hh) / mi Dim second_ As Long: second_ = (ss - day * dd - hour_ * hh - minute_ * mi) Dim strDay As String: strDay = IIf(day < 10,"0" & day,"" & day) Dim strHour As String: strHour = IIf(hour_ < 10,"0" & hour_,"" & hour_) Dim strMinute As String: strMinute = IIf(minute_ < 10,"0" & minute_,"" & minute_) Dim strSecond As String: strSecond = IIf(second_ < 10,"0" & second_,"" & second_) Duration = strDay & " " & strHour & ":" & strMinute & ":" & strSecond End Function

原文链接:https://www.f2er.com/vb/262666.html

猜你在找的VB相关文章