Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2020 : Technical Questions
Message Icon Topic: Date format in Crystal report (date with suffix) Post Reply Post New Topic
Author Message
sajhak
Newbie
Newbie
Avatar

Joined: 06 Oct 2009
Location: Sri Lanka
Online Status: Offline
Posts: 12
Quote sajhak Replybullet Topic: Date format in Crystal report (date with suffix)
    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
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet 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
 
IP IP Logged
sajhak
Newbie
Newbie
Avatar

Joined: 06 Oct 2009
Location: Sri Lanka
Online Status: Offline
Posts: 12
Quote sajhak Replybullet Posted: 22 Oct 2009 at 12:27pm
Hey DBlank ,

It worked exactly the way i wanted... soooooo thanks ... TC
IP IP Logged
jtfrancispi
Newbie
Newbie
Avatar

Joined: 03 Jun 2014
Online Status: Offline
Posts: 1
Quote jtfrancispi Replybullet 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
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.031 seconds.