dbWriter Date/Time Function ASP code
Format date and time or remove seconds from time.
<%
Private Function Format(byVal theInput, byVal strFormat)
On Error Resume Next
Select Case lcase( strFormat )
Case "general date"
Format = FormatDateTime(theInput, 0)
Case "long date"
Format = FormatDateTime(theInput, 1)
Case "short date"
Format = FormatDateTime(theInput, 2)
Case "long time"
Format = FormatDateTime(theInput, 3)
Case "short time"
Format = FormatDateTime(theInput, 4)
Case "time no seconds"
Dim DT
Dim TimePart
Dim AMPMPart
DT = TimeValue(theInput)
TimePart = Left(DT, Len(DT) - 6)
AMPMPart = Right(DT, 2)
Format = TimePart & Lcase(AMPMPart)
Case Else
Format = theInput
End Select
On Error GoTo 0
End Function
%> |
|