Link to home
Start Free TrialLog in
Avatar of Eirman
EirmanFlag for Ireland

asked on

Adapt Excel Date Code For Access

I use the following code in Excel to format today's date like this .......
11th April     3rd April     1st March    14th May       31st July

EXCEL CELL Contains this (No VBA Used)
=TEXT(TODAY(),"d") & IF(OR(MOD(TEXT(TODAY(),"d"),100)={11,12,13}),"th",CHOOSE(1+MIN(4,MOD(TEXT(TODAY(),"d"),10)),"th","st","nd","rd","th")) & " " & TEXT(TODAY(),"mmmm")

Open in new window

Can it be adapted to work in Access 2013 ?
Avatar of Norie
Norie

Perhaps.
OrdinalDate:Format([DateField], "d") & Switch(Day([DateField]) <> 11 And Day([DateField]) Mod 10 = 1, "st", Day([DateField]) <> 12 And Day([DateField]) Mod 10 = 2, "nd", Day([DateField]) <> 13 And Day([DateField]) Mod 10 = 3, "rd", True, "th") & " " & Format([DateField], "mmmm")

Open in new window

Avatar of Eirman

ASKER

@Norrie - I need the code in a text box
At the moment I have =Date()    Format = dddd - dd mmmm yyyy

It your code a VBA function?
ASKER CERTIFIED SOLUTION
Avatar of Norie
Norie

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Eirman

ASKER

That appears to be working fine Norie
I'll check it with a few different dates before closing the question.
Avatar of Eirman

ASKER

I changed the computer clock a few times and everything is okay.
Thank You.