Tips and Tricks
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Tips and Tricks
Message Icon Topic: Dates Year Error Post Reply Post New Topic
Author Message
NewJack
Newbie
Newbie


Joined: 24 Nov 2009
Location: United States
Online Status: Offline
Posts: 6
Quote NewJack Replybullet Topic: Dates Year Error
    Posted: 03 Dec 2009 at 6:56am
I am trying to create the following formula:
 
       datediff ("ww", cdate(invoice_date), currentdate)
 
When I add it to my report I get an error:
 
      "Dates must be between year 1 and year 9999."
 
In the DB2 DB it has the invoice field as a int. (20090123).
 
How can I work around this to get the number of days between these to dates?  Do I have to convert the invoice date in Crystal?  If so how?
 
Apprciate the help.
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 03 Dec 2009 at 7:08am
There are a number of ways to convert the int to a date field, here is one way:
 
IP IP Logged
NewJack
Newbie
Newbie


Joined: 24 Nov 2009
Location: United States
Online Status: Offline
Posts: 6
Quote NewJack Replybullet Posted: 03 Dec 2009 at 7:33am

Thanks for the help....

I still get the error, but after playing around with what you send I did the following input and and output:
 
        input:     left(totext(invoice date),10)
 
        output:  20,090,922
 
How do I remove the commas?
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 03 Dec 2009 at 7:51am
left(totext(invoice date),10,'')
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 03 Dec 2009 at 7:59am
If it was choking on a comma try...


Edited by DBlank - 03 Dec 2009 at 7:59am
IP IP Logged
NewJack
Newbie
Newbie


Joined: 24 Nov 2009
Location: United States
Online Status: Offline
Posts: 6
Quote NewJack Replybullet Posted: 03 Dec 2009 at 8:07am
You Rock.
 
Thanks for your help.
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.000 seconds.