Print Page | Close Window

Date format in Crystal report (date with suffix)

Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2020
Forum Name: Technical Questions
Forum Discription: Formulas, charting data, Crystal syntax, etc.
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=8094
Printed Date: 28 Apr 2024 at 3:10pm


Topic: Date format in Crystal report (date with suffix)
Posted By: sajhak
Subject: Date format in Crystal report (date with suffix)
Date Posted: 22 Oct 2009 at 11:23am
Hi all,

I need my programme to display the dates in a crystal report, in the following format ..

    01 st Jan 2009
    02 nd Mar 2010 ..

here i need to display the date suffixes (st, nd, rd, th .. )
at the moment it displays as 01 - Jan - 2009 ...

Is there a way to do this in CR or VB .. please help me on this..

Thanks a lot in advance

Saj



Replies:
Posted By: DBlank
Date Posted: 22 Oct 2009 at 12:07pm

one way:

right click on the field and select format field
click on the Date Tab
click on Custom field
If it is date time make it Date only
click on the date tab
Change your formating to the way you want it
in the seperators
prefix=Non
First = use a formula
if day({table.datefield})=1 then ' st ' else
if day({table.datefield})=2 then ' nd ' else
if day({table.datefield})=3 then ' rd ' else
if day({table.datefield})>3 then ' th '
Second = ' '
Suffix=None
 


Posted By: sajhak
Date Posted: 22 Oct 2009 at 12:27pm
Hey DBlank ,

It worked exactly the way i wanted... soooooo thanks ... TC


Posted By: jtfrancispi
Date Posted: 04 Jun 2014 at 3:14am
I'd like to add to this.  Since this doesn't completely format every date, here's a modification to make it even better
right click on the field and select format field
click on the Date Tab
click on Custom field
If it is date time make it Date only
click on the date tab
Change your formating to the way you want it
in the seperators
prefix=Non
First = use a formula
if day({YourDateField})in [1, 21, 31] then ' st ' else
if day({YourDateField}) in [2,22]then ' nd ' else
if day({YourDateField}) in [3,23] then ' rd ' else
'th, '
Second = ' '
Suffix=None



Print Page | Close Window