Naureen1995
Programmer
I am trying to convert the Time field of AccPac 5.0A running on Pervasive 2000I using VB. Is there any simple way?
Thanks
Thanks
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Private Function Format_Time(Value As Variant) As String
Dim Hours As Integer
Dim Minutes As Integer
Dim Seconds As Integer
Hours = Left(Value, 2) - 5 '5 hour difference for EST.
Minutes = Mid(Value, 3, 2)
Seconds = Mid(Value, 5, 2)
If Hours < 12 Then
Format_Time = Hours & ":" & Format(Minutes, "00") & "." & Format(Seconds, "00") & " AM"
Else
If Hours > 12 Then
Format_Time = Hours - 12 & ":" & Format(Minutes, "00") & "." & Format(Seconds, "00") & " PM"
Else
Format_Time = Hours & ":" & Format(Minutes, "00") & "." & Format(Seconds, "00") & " PM"
End If
End If
End Function