<% Function fncGetDayOrdinal( _ byVal intDay _ ) Dim strOrd Select Case intDay Case 1, 21, 31 strOrd = "st" Case 2, 22 strOrd = "nd" Case 3, 23 strOrd = "rd" Case Else strOrd = "th" End Select fncGetDayOrdinal = strOrd End Function ' fncGetDayOrdinal Function fncFmtDate( _ byVal strDate, _ byRef strFormat _ ) On Error Resume Next Dim intPosItem Dim int12HourPart Dim str24HourPart Dim strMinutePart Dim strSecondPart Dim strAMPM strFormat = Replace(strFormat, "%m", _ DatePart("m", strDate), 1, -1, vbBinaryCompare) strFormat = Replace(strFormat, "%B", _ MonthName(DatePart("m", strDate), _ False), 1, -1, vbBinaryCompare) strFormat = Replace(strFormat, "%b", _ MonthName(DatePart("m", strDate), _ True), 1, -1, vbBinaryCompare) strFormat = Replace(strFormat, "%d", _ DatePart("d",strDate), 1, _ -1, vbBinaryCompare) strFormat = Replace(strFormat, "%O", _ fncGetDayOrdinal(Day(strDate)), _ 1, -1, vbBinaryCompare) strFormat = Replace(strFormat, "%j", _ DatePart("y",strDate), 1, _ -1, vbBinaryCompare) strFormat = Replace(strFormat, "%Y", _ DatePart("yyyy",strDate), 1, _ -1, vbBinaryCompare) strFormat = Replace(strFormat, "%y", _ Right(DatePart("yyyy",strDate),2), _ 1, -1, vbBinaryCompare) strFormat = Replace(strFormat, "%w", _ DatePart("w",strDate,1), 1, _ -1, vbBinaryCompare) strFormat = Replace(strFormat, "%a", _ WeekDayName(DatePart("w",strDate,1),True), 1, _ -1, vbBinaryCompare) strFormat = Replace(strFormat, "%A", _ WeekDayName(DatePart("w",strDate,1),False), 1, _ -1, vbBinaryCompare) str24HourPart = DatePart("h",strDate) If Len(str24HourPart) < 2 then str24HourPart = "0" & _ str24HourPart strFormat = Replace(strFormat, "%H", str24HourPart, 1, _ -1, vbBinaryCompare) int12HourPart = DatePart("h",strDate) Mod 12 If int12HourPart = 0 then int12HourPart = 12 strFormat = Replace(strFormat, "%h", int12HourPart, 1, _ -1, vbBinaryCompare) strMinutePart = DatePart("n",strDate) If Len(strMinutePart) < 2 then _ strMinutePart = "0" & strMinutePart strFormat = Replace(strFormat, "%N", strMinutePart, _ 1, -1, vbBinaryCompare) If CInt(strMinutePart) = 0 then strFormat = Replace(strFormat, "%n", "", 1, _ -1, vbBinaryCompare) Else If CInt(strMinutePart) < 10 then _ strMinutePart = "0" & strMinutePart strMinutePart = ":" & strMinutePart strFormat = Replace(strFormat, "%n", strMinutePart, _ 1, -1, vbBinaryCompare) End if strSecondPart = DatePart("s",strDate) If Len(strSecondPart) < 2 then _ strSecondPart = "0" & strSecondPart strFormat = Replace(strFormat, "%S", strSecondPart, 1, _ -1, vbBinaryCompare) If DatePart("h",strDate) >= 12 then strAMPM = "PM" Else strAMPM = "AM" End If strFormat = Replace(strFormat, "%P", strAMPM, 1, _ -1, vbBinaryCompare) fncFmtDate = strFormat If err.Number <> 0 then Response.Clear Response.Write "ERROR " & err.Number & _ ": fmcFmtDate - " & err.Description Response.Flush Response.End End if End Function ' fncFmtDate %>