Forum Moderators: open
Thanks!
Function NormalTimeString(dat)
Dim lHour
Dim sSuffix
If IsDate(dat) Then
lHour = Hour(dat)
If lHour > 12 Then
lHour = lHour - 12
sSuffix = " PM"
ElseIf lHour = 12 Then
sSuffix = " PM"
ElseIf lHour = 0 Then
lHour = 12
sSuffix = " AM"
Else
sSuffix = " AM"
End If
NormalTimeString = CStr(lHour) & ":" & Right("00" & CStr(Minute(dat)), 2) & sSuffix
Else
NormalTimeString = ""
End If
End Function
Function NormalDateString(dat)
If IsDate(dat) Then
NormalDateString = CStr(Month(dat)) & "/" & CStr(Day(dat)) & "/" & _
CStr(Year(dat))
Else
NormalDateString = ""
End If
End Function
vbLongTime returns the AM/PM indicator, but it also brings back the milliseconds.
Their isn't a named format to return the time in the format that most people in the U.S. are accustomed to seeing. (that is why the function I posted was named NormalTimeString :)