Skip to Content
0
Feb 16, 2009 at 10:13 PM

How to compare dates in Crystal Reports 2008

864 Views

Hello,

I cannot figure out how to compare the dates in the Crystal reports.

I need all dates that are in the future to be displayed with the green font.

So in the formula for the font for this texbox I've tried to use different

formulas like:

If DateDiff("d", CurrentDate, {DevelopmentTracking_SELECT.Anticipated}) > 1

Then

crGreen

or

If {DevelopmentTracking_SELECT.Anticipated} > CurrentDate Then

crGreen

(where DevelopmentTracking_SELECT is the stored procedure, and Anticipated

is a date field).

None of them worked. All dates are treated like they were in the past

comparing to the CurrentDate. If I reverse these formulas like:

If {DevelopmentTracking_SELECT.Anticipated} < CurrentDate Then

crGreen

then all dates turn to green, otherwise they always stay black.

What could be a problem here?

I would appreciate your help.

Thank you.