Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Date format - ex: 7th of November

0 views
Skip to first unread message

Aliza Klein

unread,
Nov 8, 2004, 2:11:24 PM11/8/04
to
Hi.

I have a client who wants the current date to print out as:
"??? th/nd day of the month of whatever , the current year".

As in:
2nd day of the month of November, 2004
3rd day....
11th day of the month of November, 2004

I do not see an obvious way of doing this.

Any ideas?
TIA,
Aliza

--
-----------------------------------
Aliza Klein
abk...@optonline.net
-----------------------------------


Rick Brandt

unread,
Nov 8, 2004, 2:20:25 PM11/8/04
to
"Aliza Klein" <abk...@optonline.net> wrote in message
news:wxPjd.45150$fF6.19...@news4.srv.hcvlny.cv.net...

> Hi.
>
> I have a client who wants the current date to print out as:
> "??? th/nd day of the month of whatever , the current year".
>
> As in:
> 2nd day of the month of November, 2004
> 3rd day....
> 11th day of the month of November, 2004
>
> I do not see an obvious way of doing this.

While a custom function could probably deal with this I would see if you
can convince him to go to a format like...

day 2 of the month of November, 2004
day 11 of the month of November, 2004
etc...

It's almost exactly the same thing and it eliminates having to deal with
the variable "nth", "st", "rd" issue which is the only difficult part of
what he's asking for.


--
I don't check the Email account attached
to this message. Send instead to...
RBrandt at Hunter dot com


anon...@discussions.microsoft.com

unread,
Nov 8, 2004, 2:25:40 PM11/8/04
to
hi
IF format(date,"dd") = 1 then
format(date,"dd")& "st day of the month of " &
Format(date,"mmmm") & ", " & format(date,"yyyy")
else
If format(date,"dd") = 2 then
format(date,"dd")& "nd day of the month of " &
Format(date,"mmmm") & ", " & format(date,"yyyy")
else
format(date,"dd")& "th day of the month of " &
Format(date,"mmmm") & ", " & format(date,"yyyy")
end if
end if
you would have to have a condition of each instance the
the number id changes 1st,21st,31st, 2nd, 22nd ,3rd, 23rd
ect. select case might be better.

>.
>

Dirk Goldgar

unread,
Nov 8, 2004, 2:43:33 PM11/8/04
to
"Rick Brandt" <rickb...@hotmail.com> wrote in message
news:2v9v82F...@uni-berlin.de

> "Aliza Klein" <abk...@optonline.net> wrote in message
> news:wxPjd.45150$fF6.19...@news4.srv.hcvlny.cv.net...
>> Hi.
>>
>> I have a client who wants the current date to print out as:
>> "??? th/nd day of the month of whatever , the current year".
>>
>> As in:
>> 2nd day of the month of November, 2004
>> 3rd day....
>> 11th day of the month of November, 2004
>>
>> I do not see an obvious way of doing this.
>
> While a custom function could probably deal with this I would see if
> you can convince him to go to a format like...
>
> day 2 of the month of November, 2004
> day 11 of the month of November, 2004
> etc...
>
> It's almost exactly the same thing and it eliminates having to deal
> with the variable "nth", "st", "rd" issue which is the only difficult
> part of what he's asking for.

I happen to have this lying around from a newsgroup question long ago:

'----- start of code -----
Function fncOrdinal(ByVal lngNumber As Long) As String

Dim strNumber As String

strNumber = " " & lngNumber

Select Case Right$(strNumber, 1)
Case "1"
If Right$(strNumber, 2) = "11" Then
strNumber = strNumber & "th"
Else
strNumber = strNumber & "st"
End If
Case "2"
If Right$(strNumber, 2) = "12" Then
strNumber = strNumber & "th"
Else
strNumber = strNumber & "nd"
End If
Case "3"
If Right$(strNumber, 2) = "13" Then
strNumber = strNumber & "th"
Else
strNumber = strNumber & "rd"
End If
Case Else
strNumber = strNumber & "th"
End Select

fncOrdinal = Trim$(strNumber)

End Function
'----- end of code -----

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)


Aliza Klein

unread,
Nov 8, 2004, 2:53:51 PM11/8/04
to
Unfortunately, it is for the generation of a legal document so he is kind of
picky!
Aliza

"Rick Brandt" <rickb...@hotmail.com> wrote in message

news:2v9v82F...@uni-berlin.de...

Aliza Klein

unread,
Nov 8, 2004, 2:55:58 PM11/8/04
to
THanks!
That should do the trick!
aliza

"Dirk Goldgar" <d...@NOdataSPAMgnostics.com> wrote in message
news:eli11scx...@TK2MSFTNGP14.phx.gbl...

0 new messages