Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: dates with dif formats? Post Reply Post New Topic
Author Message
jbalbo
Senior Member
Senior Member
Avatar

Joined: 17 Feb 2011
Online Status: Offline
Posts: 219
Quote jbalbo Replybullet Topic: dates with dif formats?
     Posted: 12 Dec 2012 at 10:47am
Hi

I have a table witha text fields which contains dates.
I tried to use cdate({field}) in a formula

but get a bad format I think because
some are formatted 12/12/12 and others 12/12/2012

Is there a formula l I can use to create a paramter arount this field?

Thanks
 
IP IP Logged
comatt1
Senior Member
Senior Member
Avatar

Joined: 19 May 2011
Online Status: Offline
Posts: 337
Quote comatt1 Replybullet Posted: 13 Dec 2012 at 3:39am
12/12/12 and 12/12/2012 should be evaluated as = dates if you are comparing them as dates and not strings.

So make sure the parameter is a date, and when comparing just make sure to always compare again the formula field and not the database field.

Before I usually compare dates against strings, i like to run the isdate() function.

if isdate({field}) then cdate({field}) else //


Regarding the else, I usually take a date from outside the date range I am using. If I am running a report for all dates from today -> today + 14, I will set the else to today - 1.
IP IP Logged
jbalbo
Senior Member
Senior Member
Avatar

Joined: 17 Feb 2011
Online Status: Offline
Posts: 219
Quote jbalbo Replybullet Posted: 13 Dec 2012 at 4:42am
thanks for getting back

The if isdate({field}) then cdate({field})

worked in the formula the field actually is like a catch all and had other data besides dates


Thanks
Again

IP IP Logged
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