Time Conversion
To convert a given number into HH:MM:SS
AI
Podsumowanie AI: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.
Kod źródłowy
Public Function CTime(iSeconds, bFixedLength)
Dim intHours As Integer
Dim intMinutes As Integer
Dim intDays As Integer
Dim intSeconds As Integer
Dim lngRemainder As Long
Dim sHours As String
Dim sMinutes As String
Dim sSeconds As String
If IsNull(iSeconds) Then iSeconds = 0
'17 Jun 2002, TLH. This was added to take care of
'negative values. This way the report will still run but
'will show a zero value, and clue in the auditors that
'there is a problem with that particular field...
If iSeconds < 0 Then iSeconds = 0
intHours = Int(iSeconds / 3600)
lngRemainder = CLng(iSeconds Mod 3600)
intMinutes = Int(lngRemainder / 60)
intSeconds = CInt(lngRemainder Mod 60)
sSeconds = String(2 - Len(CStr(intSeconds)), "0") & CStr(intSeconds)
sMinutes = String(2 - Len(CStr(intMinutes)), "0") & CStr(intMinutes)
'sHours = String(2-len(CStr(intHours)), "0") & CStr(intHours)
sHours = CStr(intHours)
CTime = sMinutes & ":" & sSeconds
If intHours > 0 Or bFixedLength Then
CTime = sHours & ":" & CTime
End If
End Function
Upload
Oryginalne komentarze (3)
Odzyskane z Wayback Machine