ASP常用函数收藏乱七八糟未整理版(35)
If int12HourPart = 0 Then int12HourPart = 12
strFormat = Replace(strFormat, "%h", int12HourPart, 1, -1, vbBinaryCompare)
' Insert Minutes
strMinutePart = DatePart("n", strDate)
If Len(strMinutePart) < 2 Then strMinutePart = "0" & strMinutePart
strFormat = Replace(strFormat, "%N", strMinutePart, 1, -1, vbBinaryCompare)
' Insert Optional Minutes
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
' Insert Seconds
strSecondPart = DatePart("s", strDate)
If Len(strSecondPart) < 2 Then strSecondPart = "0" & strSecondPart
strFormat = Replace(strFormat, "%S", strSecondPart, 1, -1, vbBinaryCompare)
' Insert AM/PM indicator
If DatePart("h", strDate) >= 12 Then
strAMPM = "PM"
Else
strAMPM = "AM"
End If
strFormat = Replace(strFormat, "%P", strAMPM, 1, -1, vbBinaryCompare)
FormatDate = strFormat
End Function
Function GetDayOrdinal( _
byVal intDay _
)
' Accepts a day of the month
' as an integer and returns the
' appropriate suffix
内容版权声明:除非注明,否则皆为本站原创文章。