VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



This module converts Time from AM-PM to 24hrs format.

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

Rate This module converts Time from AM-PM to 24hrs format.




    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


Download this snippet    Add to My Saved Code

This module converts Time from AM-PM to 24hrs format. Comments

No comments have been posted about This module converts Time from AM-PM to 24hrs format.. Why not be the first to post a comment about This module converts Time from AM-PM to 24hrs format..

Post your comment

Subject:
Message:
0/1000 characters