Time Function

This function gets rid of seconds, adds AM/PM in a time value. You may have to make changes depending on your server time format and region.


Function FixTime()
Dim TimeArray, CurrHour, CurrMin, AMPM

''Server is in Phoenix, I'm in EST so add 2 hours
TimeArray = DateAdd("h", 2, Time())

''Get AM/PM from time value
AMPM = " " & Right(TimeArray, 2)

TimeArray = Split(TimeArray, ":")
CurrHour = TimeArray(0)
CurrMin = TimeArray(1)

FixTime = CurrHour & ":" & CurrMin & AMPM

''Add timezone
FixTime = Trim(Right(FixTime, 8)) & " EST"

End Function

Source: Chuck Dearbeck
Viewed 11618 times