Groups | Blog | Home
all groups > sql server reporting services > march 2006 >

sql server reporting services : Errors using DATEDIFF and DATEADD formulas


photogulliver
3/31/2006 1:04:23 PM
I am trying to use the DATEDIFF function in a formula, but it isn't
working. Here is the formula that I am entering into the "Define
Formula" dialog box:

DATEDIFF("day", TimeLogged, TimeClosed)

When I click ok, it gives me the message, "The arguments to the
following function are not valid: DATEDIFF". With that in mind, I
looked in the Help file for the report builder and under the "DATEDIFF
statement" documentation, it had the following example:

DATEDIFF("month", #1/1/2009#, #3/31/2009#)

This one yielded the same results. I also tried the DATEADD formula
and got the same type of error message. Other formulas, such as YEAR,
WEEK, etc. work fine.

Does anyone have any suggestions? I get the same results using both
the Report Builder and Visual Studio 2005.
Amarnath
4/2/2006 9:49:25 PM
Hi,
the syntax is like this.

DATEDIFF("d", TimeLogged, TimeClosed)

This will work.

Amarnath.

[quoted text, click to view]
AddThis Social Bookmark Button