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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

date part with format 1st 2nd 3rd etc.

Status
Not open for further replies.

GretaD

Programmer
Mar 7, 2006
18
0
0
NO
Hi

I'm using Crystal Reports XI and Oracle database.

I have date fields that I want to extract only the day part of, and with the format 1st, 2nd, 3rd etc. Does anyone know if this is possible and which format I should specify in the formula?

Thanks!

Greta
 
I'm sure there's a simpler way of doing this but this might help until you find something better.
Create 2 formulas and append together.

Formula 1

if(day({yourdatefield}))in [1,21,31] then 'st'
if(day({yourdatefield}))in [2,22] then 'nd' else
if(day({yourdatefield}))in [3,23] then 'rd' else 'th'

Formula 2
cstr(day({yourdatefield})+{formula1name}
 
Hi

Haven't got any better tips so I will use your formula. Thanks!

Greta
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top