DateAdd() 在 SQL Server Reporting Services 中返回错误日期
我有一份以日期作为参数的报告。
如果我使用 =Parameters!Date.Value
,报告运行正常。
但是,如果我使用 =DateAdd("d", 1,Parameters!Date.Value)
,即使格式完全相同,报告也会留空:。 (注意:它根本无法运行。并不是没有值可返回,因为字段名称也不返回。)
我也尝试过 =DateAdd(DateInterval.Date, 1,Parameters!Date.Value)
=DateAdd("d", 1, 参数!Date.Value)
=DateValue(FormatDateTime(DateAdd("d", 1, 参数!Date.Value), DateFormat .ShortDate ))
及其许多变体,但我似乎无法破解它!
更新
如果我使用 DateInterval.Month
而不是 DateInterval.Day
那么日期仍会根据需要递增(12/22/2010),但表格会显示!有趣的是,我的本地设置是dd-mm-yyyy,而这些日期是mm-dd-yyyy。
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:. (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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试将报告的区域设置更改为 EN-GB(我假设您在英国),因为报告可能会在不同的日期格式之间感到困惑。
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.