Print Page | Close Window

Bad Date format

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=21160
Printed Date: 27 Apr 2024 at 7:20pm


Topic: Bad Date format
Posted By: EdBeau
Subject: Bad Date format
Date Posted: 12 Nov 2014 at 6:30am
Hello,

I am new to this forum. And relatively new to Crystal.

I am using Crystal 11. I need to get a count of tickets that were closed within 3 days. I have a {ClosedDate} field that is a string. I am not sure the plan of attack to take here.

I have tried creating a formula to convert the string to a date and then to the correct date format seen below.

If datediff("d", cdate(ToText(cDate({CallLog.ClosedDate}),"MM/dd/yyyy")),cdate(ToText(cDate({?Date T0}),"MM/dd/yyyy"))) >3 then "1" else "0"

I also tried simplifying it to (Date({CallLog.ClosedDate}) = (CurrentDate-3))

None of which are working for me. I hope this is clear. Its hard to relay something when you arent really sure what you are talking about.

Any help would be great!! Thanks



Replies:
Posted By: DBlank
Date Posted: 12 Nov 2014 at 8:09am

partially depends on what your strings look like and if they also have time involved and that is a factor and what you mean by 3 days? 3 days from what? your paramter field? Today? A start date in the record?

generally speaking it should be something like this
 
datediff('d',date(field1),Date(field2)<=3


Posted By: EdBeau
Date Posted: 12 Nov 2014 at 8:36am
I am trying to compare RcvdDate to ClosedDate.

I need to know tickets that were closed within 3 days of the RcvdDate, as well as 5Days, and Greater than 5 days. The format of the date string is YYYY-MM-DD.

When I create a formula like the one mentioned above and add it to a Running total formula I get "Bad Date Format"


Posted By: DBlank
Date Posted: 12 Nov 2014 at 8:44am

datediff('d',(mid(rcvdate,6,2)+'/'+righ(rcvddate,2)+'/'+left(recvddate,4)),(mid(closedate,6,2)+'/'+righ(closedate,2)+'/'+left(closedate,4)))




Print Page | Close Window