Search code examples
ssrs-2008dateadd

DateAdd() returns faulty Date in SQL Server Reporting Services


I have a report that takes a date as a parameter.

If I use =Parameters!Date.Value, the report runs fine.

However, if I use =DateAdd("d", 1, Parameters!Date.Value), the report is left blank, even though the formats are exactly the same:screenshot of what this looks like. (Note: it simply cannot run. It's not that there are no values to return as the field names don't return either.)


I have also tried =DateAdd(DateInterval.Date, 1, Parameters!Date.Value)

=DateAdd("d", 1, Parameters!Date.Value)

=DateValue(FormatDateTime(DateAdd("d", 1, Parameters!Date.Value), DateFormat.ShortDate )) and many variations thereof but I can't seem to crack it!


Update

If I use DateInterval.Month instead of DateInterval.Day then the date is still incremented as desired (12/22/2010) but the table shows up! Interesting how my local settings are dd-mm-yyyy and these dates are mm-dd-yyyy.


Solution

  • Try changing the locale of the report to EN-GB (I'm assuming you're in the UK), as the report might be getting confused between different date formats.