andySF
andySF

Reputation: 604

Crystal Reports Date Format

how can I format the day from a date field to print like 1st 2nd 3rd and so on? Thanks

Upvotes: 1

Views: 1794

Answers (1)

andySF
andySF

Reputation: 604

I found a solution for this.

NumberVar DayIn := Day (PrintDate);
Totext (DayIn , 0 )
& (if DayIn in 4 to 20 then 'th' else
if remainder (DayIn , 10) = 1 then 'st' else
if remainder (DayIn , 10) = 2 then 'nd' else
if remainder (DayIn , 10) = 3 then 'rd' else 'th')

from http://www.kenhamady.com/news0910.shtml

Upvotes: 4

Related Questions