Tuesday, 3 April 2012

To create the custom date[April 3rd 2012]- Crystal Report

//First Parameter -TitleDate
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')

//Final Custom Date format like-April 3rd 2012
ToText(MonthName (Month(PrintDate))) + " " + ToText({@TitleDate}) + " "+ Cstr(Year(PrintDate),0,"")

No comments:

Post a Comment