Another variation that returns the whole date in the required format:
CODE
Public Function FormatOrdinalDay(ByVal dtDate As Date) As String
Dim intDay As Integer
intDay = Day(dtDate)
If (intDay >= 10) And (intDay <= 20) Then
FormatOrdinalDay = Format(dtDate, "d\t\h mmmm yyyy")
Else
Select Case intDay Mod 10
Case 1
FormatOrdinalDay = Format(dtDate, "d\s\t mmmm yyyy")
Case 2
FormatOrdinalDay = Format(dtDate, "d\n\d mmmm yyyy")
Case 3
FormatOrdinalDay = Format(dtDate, "d\r\d mmmm yyyy")
Case Else
FormatOrdinalDay = Format(dtDate, "d\t\h mmmm yyyy")
End Select
End If
End Function
From the Immediate window:
?FormatOrdinalDay(#12/31/1975#)
31st December 1975