by Shadab Azeem Rahil (8 Submissions)
Category: Miscellaneous
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Mon 6th May 2002
Date Added: Mon 8th February 2021
Rating: (1 Votes)
This module converts Time from AM-PM to 24hrs format.
API Declarations
'5th June 2002
'[email protected]
'http://www.akaaz.cjb.net
Dim intTimeLen, intAdd, intcount As Integer
Dim strHour, strMin, strType As String
intTimeLen = Len(strTime)
strType = Mid$(strTime, intTimeLen - 1, intTimeLen)
intcount = InStr(1, strTime, ":", vbTextCompare)
strHour = Mid$(strTime, 1, intcount - 1)
strMin = Mid$(strTime, intcount + 1, 2)
If strType = "PM" Then
intAdd = CInt(strHour) + 12
TimeConvert = CStr(intAdd) & ":" & strMin
Else
TimeConvert = strHour & strMin
End If
End Function