Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

date

Status
Not open for further replies.

terre

Technical User
Feb 2, 2003
97
AU
Is there a way to format dates as

11th September 2001
21st July 2012

etc?
 
Might be more interesting to have this based on a more general purpuse oridnal function which could have uses elsewhere - something like
Code:
[blue]Public Function OrdDate(dtDate As Date) As String
    OrdDate = Ordinal(Day(dtDate)) & " " & Format(dtDate, "mmmm") & " " & Year(dtDate)
End Function

Public Function Ordinal(lNumber As Long) As String
    Dim suffix As String
    
    suffix = "th"
    If CLng(lNumber \ 10) Mod 10 <> 1 Then
        Select Case lNumber Mod 10
            Case 1: suffix = "st"
            Case 2: suffix = "nd"
            Case 3: suffix = "rd"
        End Select
    End If
    Ordinal = lNumber & suffix
End Function[/blue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top