Dispaying the Day in the Date

  • Thread starter Thread starter Simon
  • Start date Start date
S

Simon

I can display the date as 30th March 2007 is there a way to display
the day as well Friday 30th March 2006


Thanks
 
Simon

Have you looked at the Long Date format in your table/field definition?

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
Public Function DateSay(ByRef pdte As Date) As String
Dim strHold As String

strHold = Format(pdte, "dddd mmmm") & " " & NumSuffix(Day(pdte)) & " " &
Format(pdte, "yyyy")
DateSay = strHold

End Function

Public Function NumSuffix(mynum As Variant) As String
'*******************************************
'Purpose: Add suffix to a number
'coded by: raskew
'Inputs: ? NumSuffix(234)
'Output: 234th
'*******************************************
Dim n As Integer
Dim x As Integer
Dim strSuf As String

n = Right(mynum, 2)
x = n Mod 10
strSuf = Switch(n <> 11 And x = 1, "st", n <> 12 And x = 2, "nd", _
n <> 13 And x = 3, "rd", True, "th")
NumSuffix = LTrim(str(mynum)) & strSuf

End Function

To test from debug (immediate) window:
? datesay(date())
Friday March 30th 2007

HTH - Bob
 
Back
Top