Print Page | Close Window

1st,2nd,3rd, etc.

Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2020
Forum Name: Report Design
Forum Discription: The best way to design a report and problems you have encountered
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=18188
Printed Date: 28 Apr 2024 at 4:35am


Topic: 1st,2nd,3rd, etc.
Posted By: Schugs
Subject: 1st,2nd,3rd, etc.
Date Posted: 06 Dec 2012 at 4:08am
Is there away other than making my own if statement to show a number with the trailing text, IE.

On this 23rd Day of December

Thanks.



Replies:
Posted By: comatt1
Date Posted: 06 Dec 2012 at 4:12am
There are many options to setup for date, if you right click on a date field you can go to formatting and see your options, and setup your own custom date formats.


tackling the 23rd, 22nd, etc, I am not sure how to do.


Posted By: junkbox
Date Posted: 06 Dec 2012 at 2:34pm
@DateToOrdinal

WhileReadingRecords;
NumberVar DayIn := Day (PrintDate); //or your {date.field}
"On this the" 
& 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')
& " day of "
& Totext (PrintDate , "MMMM, yyyy") //again or your {date.field}


Ends up as: On this the 6th day of December, 2012

-jb



Print Page | Close Window