'********************************************************************

'*

'* Function TimeFormat

'*

'*   Author: NetorkAdminKB.com

'*  Created: 2006-01-11

'* Modified: 2006-01-11

'*

'* Purpose: Returns the given 12 Hour Time as two digits per number.

'*           

'*   Input: strTime  A string or Date value in one of the following formats

'*                     7:45:41 PM or 7:45:41 AM

'*

'*  Output: Returns the 12 hour time as a string in the format.

'*             07:45:41 PM  or  07:45:41 AM

'*

'********************************************************************

Function TimeFormat(ByVal strTime)

  'Version: 1.0 2006-01-11

  Dim aryParts, aryTime

 

  aryParts = Split(strTime, " ")

  If UBound(aryParts) = 1 Then

    aryTime = Split(aryParts(0), ":")

    TimeFormat = TwoDigit(aryTime(0)) & ":" & aryTime(1) & ":" & aryTime(2) & _

                   " " & aryParts(1)

  Else

    TimeFormat = strTime

  End If 'UBound(aryParts) = 1

End Function 'TimeFormat

Article ID: 427, Created On: 9/25/2011, Modified: 9/25/2011