Friday, February 17, 2012

DateDiff function

I can't get that function working in my SQL report. Can someone provide a sample code, please?

ThanksIn the cell expression type:

=DateDiff("d", "8/26/2005", "12/31/2005")

You can also put a function in the report code (Layout View | Properties | Code tab). And reference the code in the cell as:

=Code.CustomDateDiff("d", Now(), "12/31/2005")

Where CustomDateDiff is :

Function CustomDateDiff(Interval, Date1, Date2)

CustomDateDiff = DateDiff(Interval, Date1, Date2) & " Days left in the year."

End Function

No comments:

Post a Comment